Operators are special characters that has special meaning in a XPath expression.
Selects the children of the current context. When used at the beginning of the expression, it starts from the root node.
/root/child
Searches the document, descending from the current context. When used at the beginning of the expression, it searches the entire document from the root node.
//span
Selects the current context. By default it takes the root node as the current context.
//td[.="foo"]
Selects the parent of the current context.
/table/tr/td/..
Selecta all nodes from the current context.
/table/tr/td/table/*/td
Selects the node with the attribute and returns the attribute.
//div/@style
Selects nodes with any attributes and returns the attributes.
//@*
Expressions within round brackets takes precedence in the evaluation order
(//@*)[1]
Used both as a subscript operator and to encapsulate a filter expression.
(//td)[2]
Basic arithmetic operations such as addition, subtraction, multiplication, devision and modulo are available.
count(//td) + count(//table)