In Brief

  • Primary expressions can be a literal, a variable, a function call, a context item, a comment, or a parenthesized expression.

  • Besides the primary expressions, you can also use the arithmetic operators + , - , * , div , idiv , and mod . These operators perform addition, subtraction, multiplication, division, integer division, and modulus , respectively.

  • You can also create path expressions in XPath 2.0. XPath 2.0 path expressions are much the same as they are in XPath 1.0, with some exceptions, such as the deprecation of the namespace axis, and some additions, such as new node tests.

  • You can also create sequence expressions in XPath 2.0 that return sequences using the comma operator, and combine sequences with the union , intersect , and except operators.

  • XPath 2.0 also supports a number of comparison operators: eq , ne , lt , le , gt , and ge for comparisons of single values, and = , != , < , <= , > , and >= to work with sequences. Node comparisons with is let you compare nodes. And the order comparisons << and >> let you determine the order of nodes.

  • XPath 2.0 logical expressions are supported with the and and or logical operators. These operators let you connect logical operands.

  • The for expression lets you create a loop to iterate over your data. This expression works much like the for statement in various programming languages, and supports the use of variables . The if expression lets you create conditional statements that let you test an expression's value and branch accordingly .

  • The quantified expressions, some and every , let you perform tests on the items in a sequence. The some expression tests whether at least one item in a sequence or sequences satisfies a particular expression, and the every expression tests whether every item in the sequence or sequences satisfies a test expression.

  • XPath 2.0 also contains expressions that deal with types instance of to check an item's type, cast to change an item's data type, castable to check whether an item may be cast to a particular new type, and treat to treat an item as if it were of a different data type without actually changing the item's data type.

XPath. Navigating XML with XPath 1.0 and 2.0 Kick Start
XPath Kick Start: Navigating XML with XPath 1.0 and 2.0
ISBN: 0672324113
EAN: 2147483647
Year: 2002
Pages: 131

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: