Table of Contents
PATSY: It's only a model.
Monty Python and the Holy Grail
The term data model is probably one of the most terrifying and confusing terms to ever get written in a Web specification. That's why the XForms specification goes to great lengths to avoid that term. Instead, XForms Model is the name given to the form description. That name was chosen mainly because it wasn't "data model," but also to evoke thoughts of the Model-View-Controller (MVC) design pattern in programming. In MVC, a model contains all the essential data, and one or more views provide a viewpoint to examine or interact with the data. The XForms Model is analogous to a MVC model, and form controls, covered in Chapter 6, The XForms User Interface, serve the function of views. (There's nothing that directly maps to a controller in XForms, though portions of the processing model and XForms Events play a similar role.)
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, XPath in XForms 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.
 It doesn't help the situation any when the term infoset is often used interchangably with data model.