XPath Has Two Main Uses
- First use: Locating nodes in a tree
- Locating elements in an XML document
- A way of asking the computer for something in an XML
document (“gimme my message number!”)
... and
getting it back
- Second use: performing operations over data
- Numeric operations: counting, adding, rounding etc.
- String operations: substrings, substitutions ...
- Boolean (for conditionals); equality operations, comparisons
between numbers or nodes ...
- The emphasis of XPath has shifted in 2.0
... the
second application is now foregrounded
- (In this XPath 2.0 shows its kinship to XQuery)