XFA Specification
Chapter 13, Dealing with Data in Different XML Formats
Extended Mapping Rules
372
<farm xmlns="http://www.example.org/orchard/"
xmlns:field="http://www.example.org/field/">
<tree class="pome">apple</tree>
<tree class="citrus">lemon</tree>
<field:plant
class="tuber">potato</field:plant>
<tree field:role="border">poplar</tree>
</farm>
</property>
The resulting subtree of the XFA Data DOM would contain:
[dataGroup (property)]
[dataValue (plant) ="plant" namePrefix="field"
xmlns="http://www.example.org/field"
Finally, if both
"http://www.example.org/orchard/"
and
"http://www.example.org/field"
were excluded, only the
property
element would remain. As
an empty element it would by default be mapped to a
dataValue
node.
[dataValue (property) = ""]
The groupParent Element
XFA is designed to deal efficiently with data grouped into records. A record consists of a
dataGroup
node
with
dataValue
nodes and possibly lower-level
dataGroup
nodes under it. Most XML data documents
are already grouped this way, but some are just flat streams of elements. The flat streams nonetheless
usually consist of sets of adjacent related elements comprising logical records. This transform provides for
grouping logical records under
dataGroup
nodes, hence turning them into XFA-style records. Once
grouped the data can then be processed record-by-record rather than all at once, which reduces resource
consumption for documents containing many records. This transform also gives more control over the
mapping of records into
dataGroup
nodes than the data binding process alone.
For example, a data file contains information about a series of books as a flat series of elements:
<items>
<ISBN>15536455</ISBN>
<title>Introduction to XML</title>
<firstname>Charles</firstname>
<lastname>Porter</lastname>
<ISBN>15536456</ISBN>
<title>XML Power</title>
<firstname>John</firstname>
<lastname>Smith</lastname>
</items>
Each group of related records begins with an
ISBN
element and ends with a
lastname
element. It would
be appropriate to regroup the data so that each group of related records is descended from a unique
book
dataGroup
node. This regrouping can be done by the loader. The result is that
dataGroup
nodes are
inserted into the Data DOM which are not directly represented in the XML data document. The
dataValue
nodes from the XML data document are placed as children of the inserted groups as follows:
[items]
[book]
[ISBN = "15536455"]
[title = "Introduction to XML"]
[firstname = "Charles"]
[lastname ="Porter"]
Home Index Bookmark Pages
Pages: Home Index All Pages