XQuery Terminology
In XQuery, there are seven kinds of nodes: elements, attributes, text, namespaces, processing instructions, comments, and document nodes (also called root nodes).
XQuery Terminology
Node
In XQuery, there are seven kinds of nodes: elements, attributes, text, namespaces, processing instructions, comments, and document (root) nodes. An XML document is treated as a tree of nodes. The root of the tree is called the document node or root node.
See the XML document below:
Examples of nodes in the XML document above:
lang="en" (attribute node)
An atomic value is a node with no parent and no children.
Examples of atomic values:
"en"
Projects
An item is an atomic value or a node.
Node relationships
Parent
Every element and attribute has a parent.
In the example below, the book element is the parent of the title, author, year and price elements:
Children
A node element may have zero, one, or more children.
In the example below, the title, author, year and price elements are all children of the book element:
Siblings
Nodes that share the same parent.
In the example below, the title, author, year and price elements are all siblings:
Ancestors
A node's parent, its parent's parent, and so on.
In the example below, the ancestors of the title element are the book element and the bookstore element:
Descendants
A node's children, its children's children, and so on.
In the example below, the descendants of bookstore are book, title, author, year, and price elements: