Root Nodes
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.
|
<RootElement>
| •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. |
</RootElement> |
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.
Names of root nodes
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
$PERSISTENT | 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 | XML documents, created manually or imported. Default data file is optional. |
$HTML | HTML documents, created manually or imported. Default data file is optional. |
$HTTP | Documents accessed via HTTP/FTP, REST, or SOAP. The requested resource provides the data. |
$DB | The selected database table provides both structure and data. |
$XQ | XQuery documents. |
$FLOWFORCE | FlowForce jobs. |
$MT_CONTACTS | Added when a Read Contacts action is added. Filled with data from the client's address book. |
$MT_CALENDAR | Added when an Access Calendar action is added. Filled with data from the client's calendars. |
$MT_DBSTRUCTURE | 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. |
$MT_EMBEDDEDMESSAGE | Added to the design when the OnEmbeddedMessage event is activated, or when an Embedded Message Back action is added |
$MT_FILEINFO | Added when a Get File Info or Read Folder action is added. Holds information about the file/s and/or folder/s that are specified in these actions. |
$MT_GEOLOCATION | Added when the Start/Stop Geo Tracking action or the Read Geo Data action is added to design. |
$MT_IN_APP_PURCHASE | Added when the first In-App Purchase action is added to the design. It stores app store data about products and purchases. See In-App-Purchase Page Source for details. |
$MT_MQTT | Added when a Subscribe to MQTT Topic action is added to the design. The page source will store the data of MQTT messages received. See Actions on Message Received. |
$MT_NFC | Added when NFC Start/Stop action is added. Filled with data from last discovered NFC tag. |
$MT_PUSHNOTIFICATION | 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. |
$MT_SERVICE | Created when a service design is created. It holds run time data about service triggers. |
Note: | 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. |