How XForms Works
Forms are for collecting data, so it’s not surprising that the most important concept in XForms is “instance data”, an internal representation of the data mapped to the familiar “form controls”. Instance data is based on XML and defined in terms of XPath’s internal tree representation and processing of XML.
It might seem strange at first to associate XPath and XForms. XPath is best known as the common layer between XSLT and XPointer, not as a foundation for web forms. As XForms evolved, however, it became apparent that forms needed greater structure than was possible with simple name-value pairs. With structured data comes the need to reach into the instance data to connect or “bind” form controls to specific parts of the data structure, hence XPath.
Since XForms and XSLT are related through XPath, it is interesting to compare the two technologies. XSLT is usually described in terms of three trees, usually produced by parsing XML documents: XSLT with labeled’source tree’, ’stylesheet tree’, and ‘result tree’ and arrows
- From input sources, typically documents, a “source tree” and “stylesheet tree” are parsed into memory.
- Processing of these two trees forms a third tree, the “result tree”.
- Upon completion of processing, the result tree is serialized, typically to a new XML document.
XForms processing is similar, but combines input and output into the same tree:
a single tree, labeled ‘instance data’, with arrows in and out
- From an input source, either inline or an XML document on a server, “instance data” is parsed into memory.
- Processing of the instance data involves interacting with the user and recording any changes in the data.
- Upon submit, the instance data is serialized, typically as XML, and sent to a server.
Continue reading this great article on XML.com
