XForms
From Free net encyclopedia
XForms is two things:
1. An X Window System GUI package, licensed as LGPL available here.
2. An XML GUI package described below.
XForms is an XML format for the specification of user interfaces, specifically web forms. XForms was designed to be the next generation of HTML / XHTML forms, but is generic enough that it can also be used in a standalone manner to describe any user interface, and even perform simple and common data manipulation tasks.
XForms, much like XHTML 2.0 which is currently under development as of January 2006 and within which XForms will be embedded, differs from previous versions of XHTML. Because of this there is a learning curve for developers, but because XForms in general provides a large time savings for the development of enterprise quality web forms, it can be an attractive alternative for many uses.
XForms 1.0 (Second Edition) has been made an official W3C Recommendation on 14th March 2006. An indispensable list of errata to the 1.0 specification is available, fully incorporated into the main specification as of the Second Edition. XForms 1.1, which introduces a few improvements, is in progress as a W3C Working Draft as of March 2006.
Contents |
Differences from HTML forms
Unlike the original HTML forms, the creators of XForms have used a Model-View-Controller approach. The "model" consists of one or more XForms models describing form data, constraints upon that data, and submissions. The "view" describes what controls appear in the form, how they are grouped together, and what data they are bound to. CSS stylesheets can be used to describe a form's appearance.
An XForms document can be as simple as an HTML form (by only specifying the submission element in the model section, and placing the controls in the body), but XForms includes many advanced features. In particular, the user can bind data to an XML document, validate against XML schema data types, require certain data, disable input controls or change sections of the form depending on circumstances, enforce particular relationships between data, input variable length arrays of data, output calculated values derived from form data, prefill entries using an XML document, respond to actions in real time (versus at submission time), and modify the style of each control depending on the device they are displayed on (browser versus mobile versus text only, etc.). There is often no need for any scripting with languages such as JavaScript.
Like legacy forms, XForms can use various non-XML submission protocols (multipart/form-data, multipart/x-www-url-form-encoded), but a new feature is that XForms can send data to a server in XML format. XML documents can also be used to prefill data in the form. Because XML is a standard, many tools exist that can chop and modify data upon submission, unlike the case with legacy forms where in general the data needs to be parsed and manipulated on a case by case manner. XForms is itself an XML dialect, and therefore can create and be created from other XML documents using XSLT. Using transformations, XForms can be automatically created from XML Schemas, and XForms can be converted to legacy XHTML forms: this is basically how server side XForms work today.
Software support
At the time of this writing no widely used web browser supports XForms natively. However, various browser plugins and extensions exist. Firefox supports XForms via an extension [1].
For IE6 there is formsPlayer, which extends the browser to include not only support for the full XForms standard, but also provides DOM 2 Events, DOM 3 XPath, XML Events and the DOM 3 Implementation Registry.
FormFaces is a pure JavaScript processor. This means that XForms+HTML can be sent directly to the browser where JavaScript translates XForms controls into regular HTML form controls and processes the bindings directly within the browser. FormFaces is compatible with browsers that implement XHTML 1.0, ECMAScript-262 3rd Edition, and DOM Level 2 which includes Internet Explorer, Netscape, Mozilla, Firefox, Opera, Konquerer, Safari, and NetFront.
Another client-side solution for IE6 is called 'Convex'. It uses a hidden Java applet and is available as open source from the Chiba project. It uses the same engine as the server-side solution (see below) but offering the experience of a local implementation.
OpenOffice.org versions 2.0 and greater support XForms[2].
XForms can also be used today through various server-side technologies which convert a subset of XForms to legacy HTML forms on the fly and transparently to users. Implementations include the open source Chiba and Orbeon projects, both based on Ajax technology. The advantage to the open source server technologies is that the resulting output works in theory with almost any browser existing today (the end user will not necessarily notice that they are viewing an XForms page).
The advantage of plug-ins and other client-side technology is that these implementations, because they integrate themselves into the browser, will work with existing server architectures, can be more responsive, require fewer server fetches, and can present themselves in more user-friendly ways (i.e. controls that do not already exist in the browser, like sliding scales, can be added to a page).
The trade-off on both sides is that new software is needed; either each client must install the required plug-in, or the server architecture must change to accommodate a UI proxy. A good solution might mix both of these solutions, for instance testing the browser for Flash and serving a glitzy version for those users, but defaulting to a server solution for other users.
XForms for Mobile Devices
Benefits
XForms provides specific benefits when used on mobile devices:
- User interfaces using XForms require fewer round trips with the server and are in that sense more self contained than user interfaces using HTML 4 forms.
- Capabilities of mobile devices vary greatly; consequently the amount of the work involved in generating different user interfaces for different devices is of particular concern in the mobile world. XForms has been designed from the ground up to allow forms to be described independently of the device, which reduces the amount of work required to target multiple devices.
- XForms reduces the need for JavaScript, which is particularly interesting as JavaScript support varies greatly on mobile devices and cannot be widely relied on.
Implementations
Despite the benefits of XForms for mobile devices, XForms on mobile devices is still an emerging technology at best. Jon S. von Tetzchner, CEO of Opera, producers of the leading browser for mobile devices, says his company is currently considering support for XForms but that in his mind Webforms 2.0 makes more sense on the client side. So far, IBM, Oracle and FormFaces have produced significant initiatives:
- IBM Forms for Mobile Devices is an implementation of XForms that run on Palm-powered devices and shows how XForms can be used to create form-based enterprise applications running on mobile devices. This package has been released by IBM on alphaWorks, their site showcasing emerging technologies.
- Oracle Wireless Client has released a preview of their Wireless Client in March 2004. Despite its name, the preview contains no software that run on a mobile device. Instead, it is delivered in the form of a plug-in for Internet Explorer, hence maybe the "preview" in the name. The plug-in run XForms client-side, just like the browser would if it supported XForms natively.
- FormFaces Mobile Solution is a 100% JavaScript implementation targeted to run within NetFront browser (any ECMA-262 3rd Edition, and DOM Level 2 compatible browser) which supports many OS deployments including Palm and Pocket PC mobile devices.
- X-Smiles is a client-side Java implementation with and open source license. X-Smiles supports XForms along with a lot of current XML languages, such as XHTML, CSS, and SVG.
See also
References
- T. V. Raman: XForms: XML Powered Web Forms, Addison-Wesley, ISBN 0321154991
- Micah Dubinko: XForms Essentials, O'Reilly & Associates, ISBN 0596003692 (text available under the GNU Free Documentation License)
External links
- The Next Generation of Web Forms
- Frequently Asked Questions
- W3C Recommendation
- What Are XForms?
- Free Your Code with XForms
- Technology Reports: XML and Forms
- SVG and XForms: A primer
- XFV XForms Validator tool
- Cocoon
- Forms framework (Woody)
- Chicoon (integration of Chiba in Cocoon)
- Nuxeo's XForms engine, an Eclipse/SWT component.de:XForms