In XQuery, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction,
comment, and document nodes.
A D V E R T I S E M E N T
XQuery Terminology
Nodes
In XQuery, there are seven kinds of nodes: element,
attribute, text, namespace, processing-instruction, comment, and
document nodes. XML documents are treated as tree of
nodes. The root of the tree is called the document node or root
node.
Look at the XML document which is given below:
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
Example of nodes in the XML document above:
<bookstore> (document node)
<author>J K. Rowling</author> (element node)
lang="en" (attribute node)
Atomic values
Atomic values are nodes with no parent or children.
Example of the atomic values:
Items
Items are the atomic values or nodes.
Relationship of Nodes
Parent
Each element and attribute has one parent only.
In the example which is given below; the book element is the parent of the title, author, year, and price:
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
Children
Element nodes may have zero, one or more than one children.
In the example which is given below; the title, author, year, and price elements are all children of the book element
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
Siblings
Nodes that have the same parent is called siblings.
In the example given below; the title, author, year, and price elements are all siblings:
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
Ancestors
A node's parent, parent's parent, etc. is called ancesters.
In the example given below; the ancestors of the title element are the book element and the bookstore element:
<bookstore>
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<bookstore>
Descendants
A node's children, children's children, etc. is called descendants.
In the example given below; descendants of the bookstore element are the book, title, author, year, and price elements
<bookstore>
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<bookstore>
Be the first one to comment on this page.
Share And Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
xml terms ,xquery tutorial,xquery text,xquery examples,xquery document,java xquery,oracle xquery ,xquery xpath,xquery attribute,xquery namespace,xquery xml,xquery syntax ,xquery tool ,xquery editor ,xquery sql ,xquery function ,xquery data ,using xquery ,xquery search,xquery select