Posted On: Feb 28, 2021
An XPath Axes defines the node-set relative to the current (context) node. It is used to locate the node that is relative to the node on that tree.
Different XPath Axes are listed below:
S. N. | Axis name | Description |
1 | ancestor | This contains all the elements like grandparents, parents’ ancestors of the contextnode. In simple terms, this axis contains the root of the node. |
2 | ancestor-or-self | This refers to all the ancestor’s nodes and the root node itself (context node). |
3 | child | It refers to the child of the current node in the document during the traverse. |
4 | attribute | Refers to attributes of the current node in the specified document. |
5 | descendant | This refers to the descendants of the context node in the XML document. Namespaces or attributes are not included here. |
6 | descendant-or-self | This refers to the descendants of the context node in the XML document and the context node itself. |
7 | following | This contains all the nodes after the context node in a specific order but excluding the context node's descendants. |
8 | following-sibling | It contains the next subsequent nodes siblings followed by the root node. |
9 | self | Specifies their present node in the tree. |
10 | parent | It contains only one parent of the current node. |
11 | namespace | It refers to the namespace node of the root node with xmlns. And the axis is empty only when the context node is an element. |
12 | preceding | It contains all the nodes that come before the current tags(node). |
13 | preceding-sibling | The node traversed by the current context node to a previous sibling tag. |
Never Miss an Articles from us.
XPath stands for XML Path Language. It is defined as a query language for selecting nodes from an XML document. It is used to find values such as strings, numbers, or Boolean values from the content o...
XPath Path Expressions are a combination of variables and operators. To select nodes or node-sets in an XML document XPath uses path expressions that are used in JavaScript, Java, XML Schema, PHP, Pyt...
XPath stands for is used to find the location of any element on a webpage or to navigate through elements and attributes in an XML document....