Page Source Trees
Tree structure
A page source has an XML tree structure. The screenshot below shows the XML tree structure of a page source that is a DB table.
The structure of a page source is created in the following ways:
•Imported from an XML or HTML document, or an XQuery statement, when a page source is added (see Page Sources), or subsequently
•Created manually in the Page Sources Pane by adding elements and attributes to a new empty XML tree (via the pane's toolbar icons)
Accessing tree nodes
The nodes of every page source in the page can be accessed by XPath expressions anywhere in that page.
On each page, any node in any tree can be set as the XPath context node for that page (by right-clicking the node and selecting Set as Page XPath Context). All XPath expressions on the page will then be evaluated in the context of that node. The XPath context node of a page is indicated with the text XPath Context. In the screenshot below, $XML1 is the XPath context node of the page. All XPath expressions on this page will be evaluated relative to $XML1.
Whether a page context node is set or not, any node can be addressed by starting the locator expression with the root node of the specific tree. For example, in the XQuery statement that is highlighted in the first screenshot on this page, the second line has a let expression that locates the @id node with a locator expression that starts with the root node $DB2.
A source node (or page source link) is a tree node that is associated with a control.
•A source node is associated with control by dragging the source node from its tree onto the control.
•Once a source tree node has been defined as a page source link, it is displayed in a bold font in the page source tree.
•Typically, a page source link is used to display the source node's content in the control; for example, a Label control would display the content of the associated page source link.
•In the case of charts and repeating tables, the control's source node serves as the context node (XPath origin) of all XPath expressions used to define properties of the control.
Tree data
The data that is used in a MobileTogether solution is stored in the nodes of the project's page source trees. This data is obtained in one of the following ways:
•A file is specified as the default file of a page source. This file must have a structure that corresponds to the structure of the page source. Its data is then used as the data of the page source.
•A node can be given a fixed value (via the Ensure exists (fixed value) command in the node's context menu). This value overrides any value imported from a default file.
•A node is assigned an XPath expression (via the Ensure exists (XPath value) command in the node's context menu). The XPath expression generates the content of the node. This value overrides any value imported from a default file.
•A node is updated when an event is defined to trigger an Update node action, or when a node is the source node of a control that provides editing functionality (for example, the combo box and edit field controls).
Page source links
A source node (or page source link) is a page source tree node that is associated with a control. In the cases of controls that provide editing functionality—such as the combo box and edit field controls—data edited by the end user is passed to the tree node. A source node is assigned to a control by dragging it from the Page Sources Pane onto the control.
The page source link of a control is displayed in bold in the page source tree. When you hover over a page source link, a popup provides information about the associated control/s in the design. Conversely, controls that are associated with a page source link have an icon at the control's top left. Hovering over the icon displays information about the associated page source link.