gatherNameSpaces
The GatherNamespaces command and function scans a tree structure for namespace definitions in all sub-nodes within the tree, and copies all of those namespace definitions to the top level of the tree. Node expressions that specify a node using a name that includes a namespace prefix may fail if that namespace is not declared in the top level (root node) of the tree. Using GatherNamespaces to copy namespace definitions to the root of the tree makes it possible to locate nodes within the tree using namespace-qualified names that might otherwise fail.
Command
When you call GatherNamespaces as a command, you must pass the tree by reference to allow the function to make changes to the tree.
Example:
gatherNamespaces myTree by reference -- pass the tree by reference to allow changes
put node “//web:table” of myTree into myTableNode -- namespace-qualified name should now be successful
Further Reading
Resources in our other reference manuals:
Function
When called as a function, GatherNamespaces returns a modified copy of the tree.
Example:
put node “//namespace:name” of myTree.gatherNamespaces -- call gatherNamespaces so the node reference will succeed
Further Reading
Resources in our other reference manuals: