May 28, 2021 XPath
In XPath, there are seven types of nodes: elements, properties, text, namespaces, processing instructions, comments, and document (root) nodes. X ML documents are treated as node trees. The root of a tree is called a document node or root node.
Take a look at this XML document:
Examples of nodes in the XML documentation above:
The base value is a node without a parent or child.
Examples of basic values:
A project is a base value or node.
Each element and property has a parent.
In the following example, the book element is the parent of the title, author, year, and price elements:
Element nodes can have zero, one, or more children.
In the following example, the title, author, year, and price elements are all children of the book element:
A node that has the same parent
In the following example, the title, author, year, and price elements are all siblings:
The parent of a node, the parent of the parent, and so on.
In the following example, the title element's ancestors were the book element and the bookstore element:
The child of a node, the child of a child, and so on.
In the following example, the bookstore's descendants are the book, title, author, year, and price elements:
In the next section, we'll cover the syntax of XPath.