Chapter 4, Exchanging Data Between an External Application
and a Basic XFA Form
XFA Specification
Loading a Template to Produce the XFA Template DOM
153
Loading a Template to Produce the XFA Template DOM
Loading an XFA Template DOM is a two-step process, which involves first creating an XML Template DOM
and from that creating an XFA Template DOM.
Template
DOM
XML Form Template
XML
DOM
XML
User’s XML Data
Data
DOM
Template loading produces an XFA Template DOM
Creating an XML Template DOM
The XML Template DOM is filled with the complete content of the XML Form Template in the usual manner
for XML DOMs.
Creating an XFA Template DOM
A subset of the contents of the XFA Template DOM is copied into the XFA Template DOM. This subset
excludes:
●
●
●
elements and attributes which are not in the XFA template namespace
elements and attributes which are not recognized by the XFA processor as part of the template schema
elements which do not belong in the current view, for example an element that is marked as relevant
only to printing but the current application is interactive
It is an error for the XML Template DOM to contain elements or attributes in the XFA template namespace
that are not part of the template schema, but it is not a fatal error. A warning message may be generated
but processing continues. It is not an error for the other types of excluded content to be present.
The nodes of the XFA Template DOM are peered to the nodes of the XML Template DOM to allow the XFA
processor to make changes to the XFA Template DOM and then save the modifed template as a new XML
Form Template.
After this the XFA processor resolves prototypes. For each prototype reference it copies content from the
referenced prototype into the XFA Template DOM. Some prototypes may be in external XML Form
Templates, so resolving prototypes may involve creating and loading additional transient XML Template
DOMs and corresponding transient XFA Template DOMs. The transient DOMs are retained during
subsequent prototype processing so that subsequent references to the same document can be processed
without reloading. (This is not only for performance reasons. It also protects against loss of internal
consistency should the external document be modified during processing.) Once all prototypes have been
resolved, including nested prototype references, the transient DOMs are deleted.