Community articleThe Sample Tree Structure
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.

Each tree begins with the form, or root, node. This node contains no information - it simply represents the starting point of the tree structure.
Below the form node are the page nodes. In the previous example, there are two page nodes: "global" and "PAGE1". The "global" page node stores any global settings that apply to the form, and "PAGE1" stores the contents of the first form page. Additional pages are stored as siblings of the "PAGE1" node.
Below each page node are the item nodes. As shown in the previous example, the first item node of a page is always the "global" item. The "global" item stores settings that apply to the items on that page. Each additional item in the page is stored as a sibling of the global item.
Below each item node are the option nodes. Each option node represents an option setting for that item, such as a background color or font setting.
Below each option node are the argument nodes. These nodes contain the settings for the parent option. For example, the background color might be set to "blue". There can be an infinite number and depth of these nodes, depending upon the number and depth of the settings for that option.
For instance, in the sample form, the size node for "REFLINE" has two argument nodes: one for the width and one for the height. In contrast, the printsettings option can have multiple argument nodes which themselves have argument nodes as children. The following is an example of the node structure of the printsettings option:

A small sample code for print settings. Arrows match argument node levels to the corresponding lines of code.

printsettings Node Structure

A node hierarchy for print settings that shows two argument nodes are created.
Thus, in storing the printsettings option, two levels of argument nodes are created. The first level describes the number of array elements in the option (two). The second level gives the arguments for each element.
Due to their potential complexity, pay careful attention to the mapping of argument nodes.
Note: In cases where an option has multiple elements in an array (for example, printsettings), there will be a single option node, but a separate argument node for each element in the array.