XFA Specification
Chapter 13, Dealing with Data in Different XML Formats
Extended Mapping Rules
368
Data Value Elements with Attributes
Consider the following XML data document:
<item>
<book>
<ISBN>15536455</ISBN>
<title>Introduction to XML</title>
<unitprice currency="USD">25.00</unitprice>
</book>
</item>
In the above example the
unitprice
element maps to a
dataValue
node and has a
currency
attribute.
Assume the XFA configuration document has an
attribute
element containing
preserve
.
When an element mapped to a
dataValue
node has one or more attributes, the data loader maps each
attribute to a
dataValue
node that is a child of the
dataValue
node mapped to the enclosing element
as specified:
the
name
property of the
dataValue
node is set to the local part of the attribute name
the
namePrefix
property of the
dataValue
node is set to the namespace prefix of the attribute
name
the
xmlns
property of the
dataValue
node is set to the resolved namespace of the attribute name
the
value
property of the
dataValue
node is set to the attribute value
the
contains
property of the
dataValue
node is set to
metadata
As a result of processing attributes of a
dataValue
node, the data loader produces a child
dataValue
node for each attribute.
The result of the mapping is as follows:
[dataGroup (item)]
[dataGroup (book)]
[dataValue (ISBN)
= "15536455"]
[dataValue (title)
= "Introduction to XML"
[dataValue (unitprice) = "25.00"]
[dataValue (currency) = "USD" contains="metadata"]
Note that in the above mapping the value of
unitprice
does not include the value of the
dataValue
node
currency
because mapped attributes have the characteristic that they are considered to contain
metadata; only
dataValue
nodes that contain data are included in the value of a parent
dataValue
node as described in
“Data Values Containing Mixed Content” on page 128.
The data loader processes attributes prior to processing any content of the data value element. The effect
is that any
dataValue
nodes resulting from attributes appear as children of the
dataValue
node before
(left of ) any children resulting from processing content of the data value. This is in keeping with the
general structure of the XFA Data DOM as described in
“About the XFA Data DOM” on page 114,
whereby
a top-down left-to-right traversal reproduces significant document order.
The set of
dataValue
nodes resulting from processing attributes are ordered in an
implementation-defined order. The [XML] specification states that by definition the order of attributes is
not meaningful. Hence there is no justification for imposing any attribute ordering restriction upon the
data loader. On the other hand applications using the XFA Data DOM must not rely on any particular
Home Index Bookmark Pages
Pages: Home Index All Pages