XFA Specification
Chapter 3, Object Models in XFA
Scripting Object Model
88
<Tax>24.80</Tax>
<Total_Price>334.80</Total_Price>
</Receipt>
no change is required to the SOM expression referencing either Detail node. This is an important feature of
SOM expressions; they are not invalidated by the insertion or removal of other nodes with different names
and hence presumably containing unrelated information. Readers familiar with the RELAX NG schema
language will recognize this as equivalent to saying that XFA SOM supports
interleaved
elements.
XFA does not impose any built-in limit to how many sibling nodes can share the same name.
Explicitly Named Objects
In XFA SOM, an explicitly nameable object represents an element that takes a
name
attribute, rather than
relying on the element tag to supply it with a name. The following example shows an XFA connection set
that contains the named objects
ShoppingCart
,
Catalogue
,
Shipping
and
TsAndCs
.
<xdp …>
<connectionSet xmlns="http://www.xfa.org/schema/xfa-connection-set/2.4/">
<wsdlConnection name="ShoppingCart" … > … </wsdlConnection>
<wsdlConnection name="Catalogue" … > … </wsdlConnection>
<wsdlConnection name="Shipping" … > … </wsdlConnection>
<xmlConnection name="TsAndCs" … > … </xmlConnection>
</connectionSet> </xdp>
The above objects can be referenced in SOM expressions as follows:
$connectionSet.ShoppingCart
$connectionSet.Cataloge
$connectionSet.Shipping
$connectionSet.TsAndCs
Objects are either nameable or not nameable. For nameable objects, the name specified by the
name
attribute is the only name for the object. If the
name
attribute is omitted the object has no name.
The most common reason for XFA objects being nameable, as for the
wsdlConnection
elements here, is
to make it easier to pick a particular item out of a list of items. Naming also enhances modularity by
separating the SOM expression that refers to an object from the type of the object. Here, if the
xmlConnection
is changed to an
xsdConnection
(because a schema has been published for it), it can
still be referenced using the name
TsAndCs
.
Most nameable objects are not required to have unique names. The children of a
connectionSet
are
exceptions in that they are required to have unique names. Consult the individual syntax reference for the
DOM to determine whether or not names are required to be unique.
Though it is not shown in these examples, the template element can take a
name
attribute. Despite this
the template element is not nameable, because it is a top-level packet wrapper. The
name
attribute
in this
one case only
merely holds a human-readable description of the template. The template object must
always be referenced using
xfa.template
or
$template
.
Transparent Nodes
When an explicitly nameable object is left unnamed, it is invisible to the normal SOM syntax. Such
unnamed objects are called
transparent.
Home Index Bookmark Pages
Pages: Home Index All Pages