XdmNode navigation

The XdmNode class provides DOM like methods to navigate nodes in a tree. The options available in the C++, Python and PHP APIs are as follows:

  1. In the C++ and Python APIs, simple navigation down the tree can be achieved using the getChildren() method (or children property in Python) which returns all the child nodes at a given parent node.

    For PHP, navigate down the tree using the getChildNode() method, which requires an integer index argument, and returns the i'th child node (use the getChildCount() method to get the number of child nodes).

    Use the method getParent() (get_parent() in Python) to navigate back up the tree, and the methods getAttributeNodes() and getAttributeValue(name) (attributes property and get_attribute_value(name) in Python) to retrieve the attribute nodes and their values.

  2. Since SaxonC 12.3, as an alternative to the above, the axisNodes() method (axis_nodes() in Python) is available which provides navigation of the tree using the XPath axes. The axis options are: ANCESTOR, ANCESTOR_OR_SELF, ATTRIBUTE, CHILD, DESCENDANT, DESCENDANT_OR_SELF, FOLLOWING, FOLLOWING_SIBLING, NAMESPACE, PARENT, PRECEDING, PRECEDING_SIBLING and SELF.

For more information and other methods, see the API documentation: