Expressions

Not all XPath expressions are location paths. In fact, you've already seen several that weren't. The content of the square brackets in a location step predicate is a more generic form of XPath expression. Each XPath 1.0 expression returns one of these four types:

String

A sequence of zero or more Unicode characters. This is not quite the same thing as a Java String, which is a sequence of UTF-16 code points. A single Unicode character from outside Unicode's Basic Multilingual Plane (BMP) occupies two UTF-16 code points. XPath strings that contain characters from outside the BMP will have smaller lengths than the equivalent Java string.

Number

An IEEE 754 double. This is the same as Java's double primitive data type, for all intents and ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.