Each page source is conceptualized as a tree. The root node of each tree is identified by a variable name that is unique within each MobileTogether design (project). The terminology used to address and describe the basic parts of page source trees is given below. A listing of all the page source variables of a project, together with their uses in controls and actions, can be displayed in the Messages window when you click the command Refactor | List Usages of All Page Source Variables.
/ = \$RootNodeName
•The root node is the topmost node of a tree.
•A root node is represented by a variable of the form \$RootNodeName, where RootNodeName is a name that identifies a particular tree's root node. An example is \$XML. See Names of Root Nodes below.
•The root element is the outermost element of an XML document, and contains all the other elements of the document. (In XML language, the root element is also sometimes called the document element.)
•The root element is considered to be a child of the root node.
Accessing tree nodes with XPath
The nodes of a tree can be accessed with XPath expressions. When using an XPath expression, be aware of what the context node is. One node across all the page sources of a page can be set as the XPath Context Node of the page (by right-clicking that node and selecting Set as Page XPath Context). This node will be the context node for all XPath expressions on the page. Exceptions are some controls, such as the chart and repeating table controls, which use their respective page source links as context nodes for XPath expressions that are used within the control. Whether a page XPath context node is set or not, a node in any tree is always accessible by starting the XPath expression with the tree's root node. For example: \$XML1/root/element1.
The names of root nodes are generated automatically when page sources are added. The screenshot below, for example, shows two root nodes, named \$PERSISTENT and \$XML1. The name of a root node can be changed by double-clicking it and editing it.
The automatically generated name of the root node depends on the type of the page source: XML, HTML, HTTP-accessed, DB, XQuery, or FlowForce job
The \$PERSISTENT tree is the tree saved on the client.
•This tree is created in every new design with an empty root element called Root (see screenshot above). A structure must be created for it, either manually, or by importing an XML structure via its context menu's Import command.
•Data can be assigned to the nodes of the \$PERSISTENT tree, either static data or dynamic data (using XPath expressions or by assigning a \$PERSISTENT tree node to a control).
•\$PERSISTENT tree nodes that are assigned (as page source links) to a control will be updated on the client. This means that when a solution is loaded in the client, nodes that are assigned to a control will take their data from the \$PERSISTENT tree—and not from other page sources.
XML documents, created manually or imported. Default data file is optional.
HTML documents, created manually or imported. Default data file is optional.
The selected database table provides both structure and data.
Added when a Read Contacts action is added. Filled with data from the client's address book.
Added when an Access Calendar action is added. Filled with data from the client's calendars.
Added when a DB Read Structure action is added. Has a standard structure. Nodes are filled at runtime with data from the DB that is read by the action.
Added when NFC Start/Stop action is added. Filled with data from last discovered NFC tag.
Created at design time when an action is added to the OnPushNotificationReceived event. Filled with data from the payload of a received push notification (PN). See PNs: The Receiving Solution.
Created when a service design is created. It holds run time data about service triggers.
|A root node can be renamed at any time in the design process by double-clicking its name in the Page Sources Pane and editing the name. All references to the old name in XPath expressions throughout the design will be changed to the new name.