XForms: The Next Generation of Web Forms
Articles and Tips: article
01 Sep 2003
So you are asking "Why do we need another W3C standard?" Simply put, XForms fills a significant void in HTML Web Forms. More and more, Web browsers are becoming the users' interface for applications. Companies are leveraging the network by using the Internet to connect users from everywhere, and the simplest, fastest way to do this is to deliver the interface via HTML in a browser.
What must be remembered is that HTML was created with the idea of presentation and not with the ability to manage large amounts of data or deal with intricate user interaction. Aspects of HTML do attempt to manage this, but fall short when presented with the complexities of today's Web-based applications.
In this excerpt from the XForms Tutorial that is located on the DeveloperNet Web site at http://developer.novell.com/xforms/tutorial.html, let's examine these various aspects of delivering content via the Web. (For more information, refer to the feature article on Novell's XForms Strategy in this issue of AppNotes.)
Web Forms Come of Age
Today most Web applications are being developed to use a Web browser as the user interface (UI). Great strides have been made in server implementations to provide application services that are presented in a browser. And the look and feel of these applications have been greatly improved.
What has fallen behind is the area of accepting input from the user--more often called the form. Although some advances have been made in forms technology, its inconsistent implementation across browsers and its reliance on scripting for client-side processing has made implementing robust forms difficult, with most processing being done on the server. This approach does not take advantage of the power of the client's hardware running the browser.
A Model Implementation
XForms is an XML language for describing what a form in a Web application is to do and how it is to be presented. The implementation is typically going to be part of an XHTML form, and the tutorial discusses it in that context. A key design feature of XForms is the separation of purpose from presentation in a form.
Data (or Instance Data). The purpose of the form is called the model and is described in the head element of an XHTML form. The model specifies the instance data that is used on the form and is requested as input from the user. This instance data can be referenced in the model directly or as a link to an external XML file. A schema for the instance data can be used to provide data typing and validation requirements.
Logic. The model also contains actions that specify the behavior of the form and validation requirements. You can specify which fields are required and under what conditions they are required. The XForms processor can then guide the presentation and interaction with the user without making a round trip to the server. This improves response time while taking advantage of the power of the client hardware. Also, you can call many functions that are native to XForms such as sum, average, minimum, maximum, and so on.
Presentation. XForms provides a standard set of UI visual controls that describe an abstract concept of collecting data from the user but leave the implementation to the XForms processor. For example, select1 provides a list of values from which the user can select only one. This could be implemented as a series of radio buttons, a drop-down list, or some other mechanism appropriate to the target platform.
For describing the layout, color, and fonts used in the presentation, XForms uses Cascading Style Sheets (CSS). This provides for a flexible approach to design and separate the controls that are used on the form from their style features. In this way different styles can be used with the same form--styles that take advantage of the features of a particular target platform or that can even provide a different look and feel.
Overview of XPath
An important part of XForms is the use of other XML technologies to provide a robust and rich feature set. Some of these XML technologies are XML Schema, XML events, and XML Path language (XPath). XPath is a language that provides a mechanism for identifying what content of XML document (elements and attributes) you are interested in using or retrieving. A rich set of functions is provided that allows you to manipulate the content. The syntax used to address elements and attributes in a document is similar to the syntax in navigating and using a file system. Similarly, the context node is like the current directory of a file system in that it is used to resolve relative expressions.
XPath models the XML document as a tree of nodes, including element, attribute, and text nodes. These nodes can be converted into a string value, and some nodes (such as element and attribute) have names. The name fully supports XMLNamespaces, and therefore a name is comprised of a local name and an optional namespace URL. In using XPath you create an expression that will evaluate to one of the following four basic types:
Node-set (an unordered collection of nodes without duplicates)
VALUE=1>Boolean (true or false)
VALUE=1>Number (a floating-point number)
VALUE=1>String (a sequence of UCS characters)
Expressions. The expression is evaluated to identify a node or node-list with respect to a context. The most common kind of expression is a location path (similar to a path in a file system) that can be expressed in an unabbreviated syntax or more commonly with an abbreviated syntax.
The location path can be relative or absolute. A relative location path consists of a sequence of one or more location steps separated by a forward slash in quotation marks ("/"). An absolute location path consists of a forward slash and quotation marks that are optionally followed by a relative location path, which again consists of a number of location steps. A location step has three parts:
An axis, which specifies the tree relationship between the nodes selected by the location step and the context node
A node test, which specifies the node type and expanded name of the nodes selected by the location step
Zero or more predicates, which use arbitrary expressions to further refine the set of nodes which the location step selects.
The XPath expression can also include functions that will operate on the contents of the selected node or are evaluated to identify the node or nodes. The following sections list most common operators and abbreviated axes, functions, as well as some examples of XPath in action.
XPath in XForms. If you are familiar with XPath and have used it in the past, there are three important things to understand when writing an XPath expression in an XForms application.
When you use XPath in XForms, you specify the XPath expression in an attribute of an XForms element. If the instance data you are referencing is in a namespace, a prefix for that namespace must be in the scope for the XForms element holding the attribute. The simplest way to accomplish this is to specify the namespace prefix at the highest level possible. Assuming that your XForms is defined as part of an XHTML page, define your namespace in the HTML element, which is the root element for an XHTML page.
When you refer to instance data in an XForms document, absolute paths begin in the <instance> element of that data. So "/a/b/c" might refer to "/html/head/xforms:model/xforms:instance/a/b/".
For relative paths, the context node is the root element of the instance data ("a" above), so you would use "b/c" to refer to the same node as above. Be aware that the context node is changed by all XForms elements that have a reference or nodeset attribute. So children of an <xforms:group ref="/a/b"> element have b as their context node, and so "c" would refer to the "/a/b/c" node.
To better understand and to work with XForms using the Novell XForms Technology Preview (Processor) application, visit the main Novell XForms page at the http://developer.novell.com/xforms/ URL. Here you will be able to download the XForms Technology preview for Linux, Solaris, Windows and Java Web Start. You will also find links to additional resources on XForms, including the complete XForms Tutorial and Novell's positioning paper on XForms.
Additional information of XForms and the most up-to-date status on the XForms standards can be found at http://www.w3.org/MarkUp/Forms/, the W3C's XForms page.
On the Leading Edge
So what's new on the Novell Developer's Kit (NDK)? If you frequent the Leading Edge page on the NDK, you will not only see the links to download the XForms Technology Preview (see the previous article), but you'll also see a couple of other interesting advanced previews of developer technologies.
GroupWise Trusted Application APIs
With the recent release of GroupWise 6.5 came the ability for developers to create applications that GroupWise recognizes as "Trusted." Using the GroupWise Trusted Application API enables you to develop applications that can login to any user's mailbox without supplying the user's password and perform various tasks. Currently, Trusted Application APIs are accessible through C++ only. Using the trusted API requires that you be familiar with ConsoleOne and the standard GroupWise APIs and product documentation.
To download the GroupWise Trusted APIs from the NDK's Leading Edge, go to http://developer.novell.com/ndk/leadedge.htm and download Leading Edge 201.
Novell BorderManager is one of the premier firewall and VPN technologies that enable secure identity management solutions. With its powerful directory-integrated features, you can control your users' access to corporate resources and monitor their Internet activities. Using the Leading Edge BorderManager developer kit, third-party developers can integrate their filtering applications directly with BorderManager. Versions of the APIs are available for both BorderManager 3.7 (Leading Edge 209) and BorderManager 3.8 (Leading Edge 210) and may be downloaded form the Leading Edge page (see URL above).
Leading Edge 196 is the Novell SAML Toolkit. Security Assertions Markup Language (SAML) is an XML language that facilitates the exchange of authentication, attribute, and authorization information. SAML is in essence an XML schema and encoding for expressing security information. Leading Edge 196 presents the Novell implementation of SAML and example of using SAML in the Novell environment. This kit contains nsamltk.jar, which is the Novell SAML Toolkit Jar API and the complete JavaDoc for the Toolkit along with two very full-featured examples of the use of the SAML kit.
What's New--Developer Kit AdditionsRecent additions to the Novell Developer Kit include:
Certificate Server for Java. Certificate Server for Java enables you to access the Certificate Server API directly from your Java programs. This API provides a JNI interface to the native Certificate Server API, which is supported on all eDirectory platforms.
DSML for eDirectory (SOAP). DSML is an OASIS standard for representing directory information as XML elements. It provides your application a standard way to present and transfer directory information in XML format. DSML v2 for eDirectory contains a deployable Web archive (.war) that enables you to access eDirectory as a Web service using SOAP.
exteNd Composer. Novell exteNd Composer is a comprehensive integration server that combines the flexibility of Extensible Markup Language (XML) with the power of market-leading J2EE application servers. By using exteNd Composer, a developer can create wrappers around a data source and integrate that data source into other business logic. This means that data can be used where and by whatever resource requires it. This is an extremely powerful tool for today's integration-rich IT environment.
SecretStore Command Beans. SecretStore Command Beans provide easy-to-use Java components to integrate Web applications with the Novell SecretStore. These components enable management and usage of SecretStore over the Web with features such as creating enhanced protected Secrets and repairing and unlocking the SecretStore.
The Novell SecretStore Command Beans (eCommerce Beans) provide easy-to-use Java components to develop Web Applications that make use of SecretStore functionalities. These components:
Provide command beans designed for use in the Model-View-Controller (MVC) architecture
Use open protocols
Are written entirely in Java
Have no dependencies on native code
The SecretStore Command Beans integrate web applications with SecretStore for single sign-on. These components enable initialization of the SecretStore and read/remove a secret. They also enable enhanced protection and lockout options and support for sharing the secrets with multiple Novell applications.
Novell JVM 1.4.1 for NetWare. The Novell JVM 1.4.0 for NetWare runs Java applications, servlets, and applets in a NetWare environment. The Novell JVM for NetWare Graphical User Interface (GUI) allows you to run graphical Java applications. JVM 1.4.0 includes a feature that lets you export the display of X Client programs to any machine running X Server.
* Originally published in Novell AppNotes
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.