XPath Cheat Sheet
XPath expression is used to select XML nodes or more.
Selecting Nodes
: Select 'item' nodes from the root node.
: Select all 'item' nodes.
: Select all 'price' elements that are children of 'item' elements.
: Select children node of 'item'.
: Select the second 'item' element from the root node.
: Select 'id' attribute of 'item' element.
: Select 'item' elements with attribute 'id' of value 123.
: Select 'item' elements with attribute 'price' greater than 100.
: Select a processing instruction with the target 'xml-stylesheet'.
: Select 'glove' and 'shoes' elements that are children of 'item' elements.
: Calculate 10 + 5
: Select all 'Coffee' elements with an attribute called 'name' that its value starts with 'Ethiopia'.
: Select all 'Item' elements with an attribute called 'name' that its value contains 'shield'.
: Select all the last 'Item' elements among the 'Item' children elements for each parent.
: Select all 'Item' elements that have the text 'New item'.
: Select all 'Item' elements that have the text containing 'New' as a substring.
: Select all 'Item' elements that have its child.
: Select all 'Item' elements that have a child element 'Magic'.
: Select all the texts of 'Item' elements.