• +49-(0)721-402485-12
Ihre Experten für XML, XQuery und XML-Datenbanken

Node properties

As already described, a XML document in the XQuery data model is depicted as a tree of nodes. Each node has its own identity (not to be confused with an ID attribute value). Even if two nodes have the same value, they are not identical. A node is onyl identical with itself.

Document order

The order in the tree also defines an order to the node, namely the document order (order of the nodes in the document) which arises if the tree is run through in the following way:

  • The parent node is directly visited before its children.
  • Namespace nodes of an element are visited before the attribute nodes of the same element.
  • Attribute nodes are visited before the children of an element node.
  • Sibling nodes are visited in the same order as they have in the XML document.

As a consequence, the document node is the first node in the document order. This document order is a total order. Although XQuery does not specify an order between attribute nodes or namespace nodes, it must be determined by a XQuery implementation. Some XQuery operations sort a sequence of nodes by the document order (for example path expressions). This always also includes the removal of dublicates, meaning the elimination of identical nodes.


Source: "XQuery – Grundlagen und fortgeschrittene Methoden", dpunkt-Verlag, Heidelberg (2004)

<< backnext >>