Vous êtes sur la page 1sur 4

Node Structure | 1

Node Structure
This document is intended to explain the node structure of an XFDL document. XFDL is an XML-based
language; if you are familiar with XML hierarchical node structures you will have little difficulty
dealing with the XFDL document structure. This document does not assume knowledge of XML.
A typical XFDL form contains a variety of elements, such as multiple pages, fields, labels, and images.
When loaded, the Viewer organizes these elements into nodes.
These nodes link to create a top-down hierarchy that is similar in appearance to a family tree. At the top
there is a single node that is the parent of all the other nodes. As you add new nodes, or children, to the
hierarchy, it grows downward and outward. The result resembles an inverted tree, as illustrated in the
following diagram:

As you can see, the hierarchy forms natural levels that reflect the types of elements discussed earlier.
Nodes of the same type always reside on the same level of the tree.
Each node corresponds to the form element of the same name. The levels of this hierarchy, in
descending order, are:
 Form - This is the highest level of the tree. It always consists of just one node: the form node,
which is created automatically. All other nodes are descendants of it.
 Page - This level always contains a minimum of two page nodes. The first is a special page
node called the global page node. This node specifies configuration settings for the form as a
whole. The second node represents the first page in the form. As you create new pages in your
form, a new page node represents each additional page.

© 2005 IBM® Corp. All Rights Reserved.


2 | Referring to Element Content

 Item - Item nodes are descendants of page nodes. Items are always contained within a page. A
page can have an unlimited number of item nodes.
 Option - Option nodes are the children of item nodes, and are always contained within their
parent item or page node. You can also place custom options within page or item nodes. An
item can have an unlimited number of option nodes.
 Argument - These nodes store settings for option nodes, and are always contained by their
parent option node. Argument nodes can contain other argument nodes. There can be an
unlimited number of sub-levels in the argument level.

Referring to Element Content

You can refer to specific values or content in a form. This allows you to copy information from one item
or option to another. One method of such content copying is called referencing. For example, if you
wanted some address labels on pages 2 and 3 to contain the same information as the address field on
page 1, you would use a reference. By telling the image items on pages 2 and 3 to look for their address
data on page 1, you allow the labels to copy the field's data.
To reference an item or option, you must use dotted notation, and follow the node structure when
referring to the name of referenced element. In other words, use a
PAGE.ITEM.OPTION[ARGUMENT] structure. For example:

PAGE1.addressField

You can also reference arrays. However, because arrays contain more than one piece of data, you must
make it clear which argument node you want to reference. To indicate which array or array element you
want to reference, you must use zero index notation. Zero index notation is a numbering system where
the first item of a sequence is numbered as zero, the second item as one, and so on.
When an option contains multiple arrays, each array is itself numbered (starting with 0) to indicate its
order within the option:

<itemlocation>
<ae>-------------------------array [0]
<ae>absolute</ae>---------------- array element [0]
<ae>220</ae>--------------------- array element [1]
<ae>60</ae>---------------------- array element [2]
</ae>
<ae>------------------------- array [1]
<ae>extent</ae>------------------ array element [0]
<ae>100</ae>--------------------- array element [1]

© 2005 IBM® Corp. All Rights Reserved.


Referring to Element Content | 3

<ae>40</ae>---------------------- array element [2]


</ae>
</itemlocation>

The itemlocation option is a two-dimensional array. The top array is array [0], the first array of the
option. The bottom array is array [1], the second array in the option.
Within each array, there are array elements (<ae>). Each array element is also zero indexed. In the
example above, array [0] has three array elements. To reference these elements, you would refer to them
as [0], [1], and [2]. The following example references the second element of the first array:

PAGE1.FIELD1.itemlocation[0][1]

If you are referring to an option that is not part of the core XFDL namespace, you must add the
namespace prefix to the custom option reference:

PAGE1.FIELD1.custom:myoption

Note: If you are referencing an item that is on the same page as the item it references, you do not
need to include the page in the reference

For more information regarding XFDL, see the XFDL Specification. This document is available on the
Workplace Forms documentation web site.

© 2005 IBM® Corp. All Rights Reserved.


4 | Referring to Element Content

© 2005 IBM® Corp. All Rights Reserved.

Vous aimerez peut-être aussi