Home » XPath Operators

XPath Operators

by Online Tutorials Library

XPath Operators

XPath defines operators and functions on nodes. An XPath expression returns either a node-set, a string, a Boolean, or a number.

A list of operators used in XPath expression:

Operator Description
| It is used to computes two node-sets.
+ Addition Operator
Subtraction Operator
* Multiplication Operator
div Division Operator
= Equal Operator
!= Not Equal Operator
< Less than Operator
<= Less than or Equal to Operator
> Greater than Operator
>= Greater than or Equal to Operator
or Or Operator
and And Operator
mod Modulus (Division Remainder)

Categorization of XPath Operators

XPath operators can be categorized in different category according to their property. Following are the different types of XPath operators:

Index Operators/Functions Description
1) Comparison Operators Comparison operators are used to compare values.
2) Boolean Operators Boolean operators are used to check ‘and’, ‘or’ & ‘not’ functionalities.
3) Number Functions/Operators Operators/Functions on Numbers.
4) String Functions It specifies various string functions.
5) Node Functions/Operators It specifies various functions and operators acting on nodes.

You may also like