In this section we will try to give you an overview of the XPath 2.0 grammar in general and how each production in the grammar should be used with PsychoPath. For the formal specifications, see the W3C web-site for XPath 2.0 specification http://www.w3.org/TR/xpath20.
String literals are written as “Hello” or ‘Hello’. In each case the opposite kind of quotation mark can be used within the string: ‘He said “Hello” ’ or “London is a big city”. To feed PsychoPath, “ ‘Hello World!’ ”or “ “Hello World!” ” can be used to feed it with strings. Remember that the ResultSequence returns AnyType so since a string is being expected as the result, first it has to be casted in the code like this: String xsstring = (String)(rs.firstValue()); Numeric constants follow the Java rules for decimal literals: for example, 4 or 4.67; a negative number can be written as -3.05. The numeric literal is taken as a double precision floating point number if it uses scientific notation (e.g. 1.0e7), as a fixed point decimal if it includes a decimal point, or as an integer otherwise. When extracting number literals from the ResultSequence, possible types to be returned include BigDecima''l (e.g. : xs:decimal: 4.67),''Int ''(e.g. : xs:integer: 4) or ''XSDouble (e.g. : xs:double 1e0). All of which need to be casted in the same manner as stated before: from AnyType to their corresponding types.
There are no boolean constants as such: true, false instead the function calls true() and false() are used.
Constants of other data types can be written using constructors. These look like function calls but require a string literal as their argument. For example, xs:float(“10.7”) produces a single-precision floating point number.