Chapter 4, Exchanging Data Between an External Application
and a Basic XFA Form
XFA Specification
Creating, Updating, and Unloading a Basic XFA Data DOM
138
(ampersand). Inside attribute values it may also use
"""
for
"""
(quotation mark) and
"'"
for
"'"
(apostrophe) as defined by the XML specification [XML].
The data unloader may insert XML-style comment(s) into the output document. It should insert a
comment near the beginning identifying itself and its version number.
Unloading Node Type Information
In order to support round-tripping the data unloader when necessary inserts attributes in particular
elements to cause them to be loaded as the correct type of node, as described in
“The xfa:dataNode
Attribute” on page 397.
The need for this attribute can arise because of deletions during processing. Consider the following
excerpt from an XML data document:
<author>
<firstname>Charles</firstname>
<lastname>Porter</lastname>
</author>
When loaded into the XFA Data DOM using default mapping rules the result is:
[dataGroup (author)]
[dataValue (firstname) = "Charles"]
[dataValue (lastname) = "Porter"]
Suppose that during processing the
firstname
and
lastname
dataValue nodes are deleted. The result
is that the XFA Data DOM contains:
[dataGroup (author)]
By default empty elements are loaded as data values. To prevent this, the data unloader writes out the
author
element with an attribute that marks it as a dataGroup.
<author xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
xfa:dataNode="dataGroup"/>
Similarly if the configuration options are such that an empty element would be loaded as a dataGroup, but
the element is being written to represent the content of a dataValue, the data unloader writes out the
element with an
"xfa:dataNode"
attribute having a value of
dataValue
. For example, suppose default
mapping rules are in force and the XML Data DOM (after some processing) contains:
[dataValue (foo) = "xyz"]
[dataValue (bar) = "xyz"]
The node
foo
corresponds to an element containing nothing but another element, but such elements are
normally loaded as data groups. Yet
foo
is a data value. When the new XML data document is created the
data unloader adds an attribute to mark
foo
as a data value.
<foo xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
xfa:dataNode="dataValue"><bar>xyz</bar></foo>
Unloading Null Data
While unloading data the XFA processor may encounter data values that are null. This is signified by the
isNull
property having a value of 1. When the XFA processor encounters a null data value, it consults the
nullType
property of the same node to find out how to represent the null data in XML. The behavior of