Altova MobileTogether Designer

Namespaces

Home Prev Top Next

Namespaces are important for correctly identifying nodes, and for correctly locating nodes with the use of XPath expressions. The Namespaces item in the Page Sources Pane (screenshot below) contains all the namespaces that have been declared for the project, irrespective of what page is currently active in Page Design View.

MTPageSrcsNamespaces

Namespaces can be declared in two ways:

 

Automatic declaration on data import: When an external XML file is added as a page source, namespaces in the source are automatically imported into the design and declared for the scope of the entire project. They then appear under the Namespaces item in the Page Sources Pane (see screenshot above). The namespace prefixes are automatically set to match the original prefixes if such matching creates no ambiguities in the design. Prefixes assigned in the namespace declaration are used in node names, and must be used in XPath expressions that are intended to locate these nodes in the page source.

User-defined: You can also add namespaces by clicking the Namespace icon in the toolbar of the Page Sources Pane (screenshot above). Being able to add your own namespaces to a project enables you to create nodes that belong to one or more user-declared namespaces. This is useful for disambiguating between nodes that have the same local name.

 

To delete a namespace, select it and click Delete in the pane's toolbar.

 

Note:A namespace prefix can be renamed at any time in the design process by double-clicking it in the Page Sources Pane and editing it. All references to the old prefix in XPath expressions throughout the design will be changed to the new prefix.

 

Note:The XPath default namespace (xpath-default-ns='') is used for all XPath/XQuery functions, including extension functions and user-defined functions.

 

© 2018-2024 Altova GmbH