# XRX

XRX or XForms/REST/XQuery is a simple and elegant web application architecture that leverages modern declarative and functional programming systems. XRX allows the developer to create rich-client web applications that perform complex functions without the need for middle-tier objects, relational databases or client-side JavaScript.
XRX is based on three standards:
* XForms on the client
* REST interfaces
* XQuery on the server
These three standards have been created by the W3C standards organization and represent their vision of the future of web application development. For discussions on alternate definitions of the XRX web application architecture see What is XRX.
This wikibook is intended as an example that specifically uses all three of these technologies to create small applications that work together.

## Related Wikibooks

There are two sibling Wikibooks that this Wikibook is designed to complement.
The XForms Tutorial and Cookbook Wikibook has over 90 sample XForms application to help you become familiar with the XForms model and XForms controls. Although XForms has only 21 elements they can be combined in many different ways to build very complex web clients.
The XQuery Wikibook is focused on using the XQuery language with almost all of the sample programs using the eXist native XML database.
The XForms Wikibook has minimal dependencies on which server you use to host your web forms. Almost all of the XQuery Wikibook does not assume any prior knowledge of XForms. This book, on the other hand, assumes that you will be using both XForms and XQuery to create a complete web application development environment.

## Subversion Repository

Many of the example programs in this cookbook are now being stored in a Subversion repository on GoogleCode. The URL for the XRX GoogleCode is here:
http://code.google.com/p/xrx
If you are using an IDE with a Subversion client such as Eclipse or oXygen, the URL for the repository is:
https://xrx.googlecode.com/svn/trunk
If you would like a read-only copy, you can use the non-SSL URL
http://xrx.googlecode.com/svn/trunk

## Table of Contents
### Introduction

* Introduction - an overview of the goals of this Wikibook and the intended audience
* Benefits of XRX - an analysis of the technical benefits of the XRX web application architecture
* XRX Application Server - how XRX has allowed the XQuery language to move from a database language to an application language
* Building your First XRX Application - some suggestions on how to get started building your first XRX application
* Background Technologies - a summary of the background technologies you will use to build XRX applications
* Patching you Browser to Support XForms - how to add functionality to support the W3C XForms standards
* XSLTForms and eXist - getting XSLT forms to work with eXist

## Common Patterns

* Application Modularity - XRX applications can be managed and reused if they have modular structure
* Data Encapsulation - XRX applications contain and manage their own data sets and provide XQuery functions as interfaces
* Standard Views - XRX applications contain standardized views of their data
* Searchability - XRX applications provide tools to search their own data and interfaces to allow it to participate in site-wide search functions
* Code Table Management - XRX applications manage code tables (selection lists) and make it easy for non-programmers to maintain these codes
* Server Field Validation - XRX can use server-side XQuery to validate a field
* Breadcrumb Navigation Bar - XRX applications are nested in a hierarchical structure an navigation breadcrumbs are context aware

### Sample Applications

* Configuration File Editor - a simple file, single user XML configuration file editor using XForms and eXist
* Dictionary Editor - a simple round-trip create/update edit using XForms and eXist
* Regular Expression Builder - a demonstration of using regular expressions in XQuery
* Autoincrement File ID - save an instance from a form into a collection and have the id automatically created by the server
* Move a Resource - simple resource move utility
* Save File Dialog - saving a file to a collection similar to a save dialog panel
* Login and Session Management - a login panel and methods of authenticating users
* File Locking - strategies to prevent multiple users from overwriting each others updates
* Selection List Generator - a tool to generate selection lists from code tables
* Glossary Term Editor - a tool to manage specialized business vocabularies
* FAQ Manager - a tool to manage frequently asked questions
* Detecting Duplicates - checking for duplicates as you type
* Data Element Editor - a tool to manage ISO/IEC 11179 data elements
* Selection List Management - tools to manage selection list codes in your XForms
* Customizing Selection Lists - customize the selection list based on role or other session variable
* Table Sorting - customization of table sort order
* NIEM Services - tools to create NIEM web services
* Product Ratings - allows users to assign a rating of one to five stars to an item in a collection
* Business Rules Template - a sample of a simple business rules template
* Metadata Shopper - a shopping cart tool for your metadata elements
* Subset Generator - a program that generates a subset of a metadata registry that is imported into an XML Schema
* XForms Generator - convert an XML Schema directly into an XForms application
* XForms Instance Generator - convert an XML Instance directly into an XForms application
* Large XForms Generator - create large XForms using a single REST parameter
* User Manager - track users and manage their login attempts, session timeouts and roles
* Map Navigation - add map navigation to your XRX applications

### XRX Patterns

* Content Routing - inspecting the content of an XML document to apply save rules
* URL Rewriting - allow URIs to reflect the logical structure of a service, not the collection structure of the database

### Related Technologies

* LAMP - Linux, Apache, MySQL and PHP
* AJAX - Asynchronous JavaScript and XML
* Adobe Flex - Adobe's system for building rich-client interfaces (Now Apache Flex)
* Microsoft Silverlight - Microsoft's strategy for putting XML in the browser (Discontinued)

### References

* Related Wikibooks
** XForms
** XQuery