-
Notifications
You must be signed in to change notification settings - Fork 0
/
xpath
69 lines (34 loc) · 1.45 KB
/
xpath
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
. - Current Node
.. - Select parent node
/ - select root node
nodename - all nodes with the name
//nodename - all nodes in tree with name
@ - select attributes
/name[1] - select first nodename element child
/name[last()] - select last name element child
/name[position()]- select name element which is at a certain position
/name[@attr] - selects child node with certain attribute
/name[@attr=xyz]- selects child node with certain attribute value
* - any element node
@* - any node with an attribute
node() - node of any kind
/name/* - selects all child elements of name
//* - select all elements in the xml
//name[@*] - select all elements with attributes
//name | //xyz - select all name AND xyz elements
13-AXES:
ancestor:: - all previous nodes
ancestor-or-self:: - all previous nodes and self
attribute:: - all attributes of current node
child:: - all children of current node
descendant:: - all descendants of current node
descendant-or-self::- all descendants of current node and self
following:: - everything after the closing tags of current node
following-sibling:: - all siblings of current node (to the right)
namespace:: - all namespaces of current node
parent:: - parent of current node
preceding:: - all preceding nodes of current one
preceding-sibling:: - all siblings preceding the current node
self:: - current node
EXAMPLES:
child::*/child::name