XQuery Terms

Nodes:

The element, attribute, text, namespace, processing-instruction, comment, and document nodes are the seven kinds of nodes in XQuery. The trees of nodes are the XML documents, and the root element is the topmost element of the tree. The document node is the root of the tree, also called the root node.

Example:




  
    ABC
    Author Name
    2020
    100
  

Explanation:

The nodes in the above XML document are:

Root element node : <bookstore>

Element node: <author>Author Name</author>

Attribute node: lang=”en”

Atomic values:

The nodes with no children or parent are called the Atomic values.

Example:

The atomic values in the above XML document are:

Author Name
"en"

Items:

The atomic values or nodes are called the items.

Relationship of Nodes:

Parent:

In XPath, one parent is there for each element and attribute.

Example:


    ABC
    Author Name
    2020
    100
  

Explanation:

In the above XML document, the book element is the parent of the title, author, year, and price.

Children:

There may be zero, one or more children for each element node.

Example:


    ABC
    Author Name
    2020
    100
  

Explanation:

In the above XML document, the title, author, year, and price elements are the children of the book element.

Siblings:

Nodes with the same parent are called siblings.

Example:


    ABC
    Author Name
    2020
    100
  

Explanation:

In the above XML document, the title, author, year, and price elements are all siblings.

Ancestors:

The ancestors are the node’s parent, parent’s parent, etc.

Example:



    ABC
    Author Name
    2020
    100
  

Explanation:

In the above XML document, the ancestors of the title element are the book element and the bookstore element.

Descendants:

The descendants are the node’s children, children’s children, etc.

Example:



    ABC
    Author Name
    2020
    100
  

Explanation:

In the above XML document, the descendants of the bookstore element are the book, title, author, year, and price elements.

Please follow and like us:
Content Protection by DMCA.com