XPath allows the use of wildcards to write more robust path expressions where the use of specific path expressions is either impossible or undesirable.
XPath wildcards can be used to select unknown XML nodes.
XPath Wildcard List
XPath defines the following wildcards on nodes to be used with the XPath expressions.
|It is used to match any node.|
|It is used to match the current node in context.|
|It is used to match any attribute.|
|It is used to match node of any type.|
Consider the following XML document:
<?xml version="1.0" encoding="UTF-8"?>
<title lang="en">A Great Book</title>
<title lang="en">Learning XML</title>
In the following table there are some examples of selection:
|Matches ALL nodes in the input XML document|
|Matches all child nodes of bookstore. In this example the only child nodes are book.|
|Matches all book nodes as children of the root node (bookstore). If there are nodes other than book under the bookstore node then this expression will only return the required book nodes.|
|Selects all attributes of the current node|
|Matches ANY element node which has an attribute defined. This example will only match title nodes.|
|Matches only title element nodes with an attribute defined.|