Xquery Terms
# XQuery Terms
* * *
In XQuery, there are seven types of nodes: elements, attributes, text, namespaces, processing instructions, comments, and document nodes (or root nodes).
* * *
## XQuery Terms
### Nodes
In XQuery, there are seven types of nodes: elements, attributes, text, namespaces, processing instructions, comments, and document (root) nodes. XML documents are treated as node trees. The root of the tree is called the document node or root node.
See the following XML document:
Harry Potter
J K. Rowling
2005
29.99
Examples of nodes in the above XML document:
(document node)
J K. Rowling (element node)
lang="en" (attribute node)
Atomic values are nodes without parents or children.
Examples of atomic values:
J K. Rowling
"en"
### Items
Items are atomic values or nodes.
* * *
## Node Relationships
### Parent
Each element and attribute has one parent.
In the following example, the book element is the parent of the title, author, year, and price elements:
Harry Potter
J K. Rowling
2005
29.99
### Children
Element nodes may have zero, one, or more children.
In the following example, the title, author, year, and price elements are all children of the book element:
Harry Potter
J K. Rowling
2005
29.99
### Siblings
Nodes that have the same parent.
In the following example, the title, author, year, and price elements are all siblings:
Harry Potter
J K. Rowling
2005
29.99
### Ancestors
A node's parent, parent's parent, etc.
In the following example, the ancestors of the title element are the book element and bookstore element:
Harry Potter
J K. Rowling
2005
29.99
### Descendants
A node's children, children's children, etc.
In the following example, the descendants of the bookstore element are book, title, author, year, and price elements:
Harry Potter
J K. Rowling
2005
29.99
YouTip