XFA Specification
Chapter 3, Object Models in XFA
Document Object Models
80
Templating versus Binding
There are two general ways in which XFA DOMs interact, through templating and through binding.
Templating
means using one DOM as a pattern in the construction of another DOM. For example, the
merge process uses the XFA Template DOM as a template for constructing the XFA Form DOM.
Binding
means tying elements of two DOMs together. The merge process binds individual data values from the
XFA Data DOM to nodes representing fields in the XFA Form DOM.
Binding results in a tighter connection than templating. Templating is a one-time process. If the XFA
Template DOM is modified after the XFA Form DOM has already been constructed, the template
modification has no effect on the XFA Form DOM. By contrast if a data value in the XFA Data DOM is
modified after it has been bound to the
value
property of a field in the XFA Form DOM, the change
propagates into the field node automatically. Similarly if the data value is updated the change propagates
automatically the other direction into the field node’s
value
property.
Either templating or binding can be a one-to-one or one-to-many proposition. When binding is
one-to-many there is one data value node bound to multiple form nodes. In this case a change in any one
of the bound form nodes propagates to the data node and from there to all the other bound form nodes.
This allows for global fields that reappear on different pages of the form, with edits in any instance
propagating to all other instances.
XML Data DOM and XFA Data DOM
The relationship between the XML Data DOM and the XFA Data DOM was alluded to earlier. Data is loaded
from the XML data document into the XML Data DOM. From there the data flows to the XFA Data DOM.
The XFA Data DOM provides a view of the data that has much of the XML-related detail abstracted away.
When changes are made to data in the XFA Data DOM, the changes are passed back to the XML Data DOM
to keep the two views of the data synchronized. When the data is unloaded (saved) it is written from the
XML Data DOM to a new XML data document.
During loading the data may be transformed in accordance with settings in the Configuration DOM. Most
of the transformations affect only the XFA Data DOM, not the XML Data DOM, so that they affect how the
data is viewed internally but not how it is represented in XML when it is unloaded. However some of the
transformations affect the XML Data DOM and therefore alter the representation of the data in XML when
it is unloaded.
The XML Data DOM and the XFA Data DOM may be loaded and unloaded all at once or a record at a time.
When operating in record mode there is a distinction between record data and global data. Record data is
the data within a record. Global data is data that is outside all records. Record data is loaded into and
purged from the two data DOMs in synchronization. By contrast global data is handled differently in the
two data DOMs. Global data is loaded into the XML Data DOM as it is encountered in the XML data
document and purged when that part of the document is past. But, once loaded, global data is retained in
the XFA Data DOM for the life of the DOM.
The processes of loading data into the Data DOMs and saving data out from the Data DOMs are described
in
“Creating, Updating, and Unloading a Basic XFA Data DOM” on page 113.
Template DOM, XFA Data DOM, and Form DOM
The Form DOM is the place where the data from the XFA Data DOM is bound to logical structure from the
Template DOM. The result is objects copied from the Template DOM into the Form DOM, with some
objects in the Form DOM bound to data in the XFA Data DOM. Note that objects in the Form DOM do not
have assigned physical locations on the page.
Home Index Bookmark Pages
Pages: Home Index All Pages