23.2 Data Types


Each XPath expression evaluates to one of four types:


A binary value that is either true or false. In XPath, Booleans are most commonly produced by using the comparison operators = , != , < , > , <= , and >= . Multiple conditions can be combined using the and and or operators, which have their usual meaning in logic (e.g., 3>2 or 2>1 is true). XPath does not offer Boolean literals. However, the true( ) and false() functions fill that need.


All numbers in XPath are IEEE 754-compliant, 64-bit floating-point numbers . This is the same as the double type in Java. Numbers range from 4.94065645841246544e-324d to 1.79769313486231570e+308d, and are either positive or negative. Numbers also include the special values Inf (positive infinity), -Inf (negative infinity), and NaN (not a number), which is used for the results of illegal operations, such as dividing by zero. XPath provides all the customary operators for working with numbers, including:




Subtraction; however, this operator should always be surrounded by whitespace to avoid accidental misinterpretation as part of an XML name






Taking the remainder


Sequence of zero or more Unicode characters . String literals are enclosed in either single or double quotes, as convenient . Unlike Java, XPath does not allow strings to be concatenated with the plus sign. However, the concat( ) function serves this purpose.


Collection of zero or more nodes from an XML document. Location paths produce most node-sets . A single node-set can contain multiple types of nodes: root, element, attribute, namespace, comment, processing instruction, and text.

Some standards that use XPath also define additional data types. For instance, XSLT defines a result tree fragment type that represents the result of processing an XSLT instruction or instantiating a template. XPointer defines a location set type that extends node-sets to include points and ranges.

XML in a Nutshell
XML in a Nutshell, Third Edition
ISBN: 0596007647
EAN: 2147483647
Year: 2003
Pages: 232

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net