Chapter 5. The XForms Model

ARTHUR: Camelot!

GALAHAD: Camelot!

LANCELOT: Camelot!

PATSY: It’s only a model.

ARTHUR: Shhh!

Monty Python and the Holy Grail

The term data model is probably one of the most terrifying and confusing terms[2] 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, 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.)

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 ...

Get XForms Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.