XPath Axes
XML Example Document
We will use this XML document in the following example:
<?xml version="1.0 " encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
##XPath AxesAxis defines a set of nodes relative to the current node.
Result | |
---|---|
Select all ancestors of the current node ( father, grandfather, etc.). | |
Selects all ancestors (parents, grandfathers, etc.) of the current node as well as the current node itself. | |
Select all attributes of the current node. | |
Select all child elements of the current node. | |
Select all descendant elements (children, grandchildren, etc.) of the current node. | |
Select all descendant elements (children, grandchildren, etc.) of the current node as well as the current node itself. | |
Select all nodes after the closing tag of the current node in the document. | |
Select all namespace nodes of the current node. | |
Select the parent node of the current node. | |
Select all nodes before the start tag of the current node in the document. | |
Select all sibling nodes before the current node. | |
Select the current node. |