An XML type input event's structure is represented as a tree. Path expressions are used to identify the position of nodes within an XML tree structure.
The format used by path expressions is shown below.
Path elements are used to identify element nodes in an XML data.
Path element | Explanation |
---|---|
Element name | Specifies the name of an element node |
* | Signifies all element nodes below the upper node |
Path operators express the relationship between path elements.
Path operator | Explanation |
---|---|
/ | Target is the node below the upper node |
// | Target is all descendant nodes below the upper node |
Note
Do not specify "//" and "*" consecutively in a path expression.
Do not specify a path expression as "/*".
If a pattern is specified in a search expression, specify the "//" path operator at the end of the expression.
Example
A sample path expression is shown below.
<company>
<name>fujitsu</name>
<employee>
<name>smith</name>
<id>2000</id>
</employee>
</company>
/company/employee/name
This path expression contains the "name" element node below the "employee" element node, which is further aligned below the "company" element node under the root node. This node is indicated by (1) in the above figure.
//name
This path expression indicates all "name" element nodes below the root node. These nodes are indicated by (1) and (2) in the above figure.
/company/*/id
This path expression refers to the "id" element node, which can be under any element node ("name" or "employee") below the "company" element node under the root node. This node is indicated by (3) in the above figure.