Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
16.75. Simple Input Path Examples
| Input Path | Description |
|---|---|
| /a/b | Match node "b" that is a child of the top level node "a". Neither node may have any same-name-sibilings. |
| /a/* | Match any child node of the top level node "a". |
| /a/*.txt | Match any child node of the top level node "a" that also has a name ending in ".txt". |
| /a/*.txt | Match any child node of the top level node "a" that also has a name ending in ".txt". |
| /a/b@c | Match the property "c" of node "/a/b". |
| /a/b[2] | The second child named "b" below the top level node "a". |
| /a/b[2,3,4] | The second, third or fourth child named "b" below the top level node "a". |
| /a/b[*] | Any (and every) child named "b" below the top level node "a". |
| //a/b | Any node named "b" that exists below a node named "a", regardless of where node "a" occurs. Again, neither node may have any same-name-sibilings. |
With these simple examples, you can probably discern the most important rules.
First, the '
*' is a wildcard character that matches any character or sequence of characters in a node's name (or index if appearing in between square brackets), and can be used in conjunction with other characters (e.g., "*.txt").
Second, square brackets (i.e., '
[' and ']') are used to match a node's same-name-sibiling index. You can put a single non-negative number or a comma-separated list of non-negative numbers. Use '0' to match a node that has no same-name-sibilings, or any positive number to match the specific same-name-sibling.
Third, combining two delimiters (e.g., "
//") matches any sequence of nodes, regardless of what their names are or how many nodes. Often used with other patterns to identify nodes at any level matching other patterns. Three or more sequential slash characters are treated as two.
Many input paths can be created using these simple rules. However, input paths can be more complicated.