5.1 Will the Real Data Model Step Forward?

XForms is based on a foundation data model, but you won't find it defined anywhere in the XForms specification. Instead, the XForms data model subsumes the XPath data model, which maps nodes to various structures in XML: elements, attributes, text, comments, processing instructions, namespaces, and a special node representing the document root. Chapter 3 describes this data model in great detail. This data model, resulting from parsed XML, is the source of nodes used in XForms.

A later section of this chapter describes the instance element, which can either point to or directly contain XML. Either way, this XML is parsed to create nodes in the instance data. (Another possibility is during "lazy author" processing, where the instance data nodes are built from scratch, without need of any author-provided XML.) The distinction between instance and instance data is subtle; a good comparison might be between the hard markup in a web page, as seen with the View Source command, and the in-memory representation accessible from the DOM. In nearly every case, XForms works from the internal instance data, ignoring the document markup. As a consequence, selecting View Source in the browser will always show the document as it was when it initially loaded, and any changes made because of XForms activity won't be visible.

A solid foundation is important, but useless without anything built on top of it. A major reason for XForms having been created in the first place is to provide useful features, such as automatic recalculation or validation. To accomplish these things in XForms, two pieces are needed in addition to the XPath foundation:

  • A set of properties for calculation, validation, etc.

  • A way to connect the properties to user form controls.

A model item is the name for an XPath node with the addition of certain XForms properties, formally called model item properties. The connection between model item properties and form controls is called binding, which is accomplished through a set of XML elements that comprise the XForms Model. The next section describes these elements.



XForms Essentials
Xforms Essentials
ISBN: 0596003692
EAN: 2147483647
Year: 2005
Pages: 117
Authors: Micah Dubinko

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net