Altova MobileTogether Designer

When a page source is added to a page, a root node is created for that page source in the Page Sources Pane (screenshot below). Depending upon the type of the page source that is added, a tree structure might or might not be automatically created. For example, when a new XML tree is created with the structure being imported from an external XML file, a structure is created automatically at the time the page source is added. On the other hand, when a page source is added via an HTTP request, for example, no tree structure is created.

MTDQS01DataSources02

After a page source has been added and a root node has been created, a tree structure can be added in the following ways:

 

By importing an XML structure from an external XML file

By manually building up the tree using commands in the toolbar of the Page Sources Pane

 

These methods are described below.

 

Importing an XML structure

Right-click the root node in the Page Sources Pane, click Import Structure from XML in the root node's context menu, and browse for the XML file to use. The following outcomes are possible:

 

If the root node has no descendant tree structure, the XML file's root element and its tree structure are imported. The XML file's root element is added as the root element of the page source.

If the root node has a root element, then this root element and all its descendants are replaced by the root element of the XML file and its tree structure.

 

The imported tree structure can be modified manually, as described below, and data can be assigned to its nodes (described in the next section, Tree Data).

 

Manually creating a tree structure

Elements and attributes can be added relative to any node in a tree structure (including the root node), and they can be deleted. Select a node in a page source, and click the appropriate toolbar command (see toolbar screenshot below). Temporary elements and attributes are intended to hold data used for calculations or data that for any other reason should not be saved to file. The data of temporary nodes is not saved.

MTPageSourcesToolbar

Icon

Command

Does this...

ic_AddSource

Add Source

Displays the Add Page Source dialog. A root node is created for the page source that is added. Only one child element can be added to a root node.

ic_AddNamespace

Add Namespace

Inserts or appends a namespace declaration under the Namespace entry. Edit the default prefix if you want, and enter a namespace.

ic_AddElement

Add Element

Inserts, appends, or adds a child element relative to the selected node.

ic_AddAttribute

Add Attribute

Inserts, appends, or adds a child attribute relative to the selected node.

ic_delete

Delete

Deletes the selected node.

 

Adding node content manually

You can manually add content to individual nodes via two commands in the context menu of the selected node:

 

Ensure Exists Before Page Load (Fixed Value): A fixed string value is added as content of the node and displayed in the tree.

Ensure Exists Before Page Load (XPath Value): An XPath expression provides the content of the node. The XPath expression and Edit XPath icon are displayed in the tree.

 

The node's content is generated before the page is loaded, and the page is passed with this node content to the client.

 

Note that content added manually in this way overrides content added via a default file or with the Ensure Exists on Load commands.

 

© 2018-2024 Altova GmbH