XFA Specification
Chapter 3, Object Models in XFA
Scripting Object Model
94
resolves to Acme, whereas the expression
$data.Receipt.Detail[1]
resolves to the node representing the first of the two Detail elements, and the expression
$data.Receipt.Detail[2]
resolves to the node representing the second Detail element. This behavior is unique to the Data DOM. For
more information, see
“Exchanging Data Between an External Application and a Basic XFA Form” on
page 113.
Selecting All Child Nodes
The syntax
".*"
can be used to select all child nodes, regardless of their names, which match the
subsequent portions of the expression.
Example 3.2
is used to illustrate selection of multiple nodes.
Example 3.2
Data used to illustrate selection of multiple nodes
<?xml version="1.0" encoding="UTF-8" ?>
<Receipt>
<Page>1</Page>
<Detail PartNo="GS001">
<Description>Giant Slingshot</Description>
<Units>1</Units>
<Unit_Price>250.00</Unit_Price>
<Total_Price>250.00</Total_Price>
</Detail>
<Page>2</Page>
<Detail PartNo="RRB-LB">
<Description>Road Runner Bait, large bag</Description>
<Units>5</Units>
<Unit_Price>12.00</Unit_Price>
<Total_Price>60.00</Total_Price>
</Detail>
<Sub_Total>310.00</Sub_Total>
<Tax>24.80</Tax>
<Total_Price>334.80</Total_Price>
</Receipt>
When the above data (Example
3.2)
is loaded into the Data DOM, the expression
$data.Receipt.*
by default yields seven nodes corresponding to all of the elements which are direct children of the
Receipt
element.
With the same data, the expression
$data.Receipt.*.Total_Price
yields two nodes corresponding to the
Total_Price
elements contained within
Detail
elements. The
Total_Price
element that is a direct child of
Receipt
is excluded because it there is no node in
between it and
Receipt
, hence nothing that matches
".*"
.
Again with the same data, the expression
$data.Receipt.Detail[0].*
Home Index Bookmark Pages
Pages: Home Index All Pages