XPath is used to perform tree navigation and to select node sets from an XML document. Each XPath operator selects a node set based on a previously selected node set. For example, with an <Order> node set, XPath can select all <OrderDetails> nodes with the Discount attribute value greater than 0.15. The resulting node set contains all the orders with a Discount attribute value greater than 0.15. Table 6.1 shows the subset of axes, functions, and operators that Microsoft supports in its implementation. Quite a bit of functionality has been left out; exactly what has been left out is enumerated in Table 6.2. Table 6.1. What Microsoft Supports Feature | Item | Axes | Attribute, child, parent, and self axes. Boolean-valued predicates including successive and nested predicates -this will be shown in the "Working with Boolean Predicates" section later in this chapter | All relational operators | =, !=, <, <=, >, >= | Arithmetic operators | +, -, *, div | Explicit conversion functions | number() , string() , Boolean() | Boolean operators | AND , OR | Boolean functions | true() , false() , not() | XPath variables | This will be shown in the examples section later in this chapter. | Table 6.2. What Microsoft Does Not Support Feature | Item | Axes | Ancestor, ancestor -or-self, descendant, descendant-or-self (//), following, following-sibling, namespace, preceding, preceding -sibling | Numeric-valued predicates | n/a | Arithmetic operators | mod | Node functions | Ancestor, ancestor-or-self, descendant, descendant-or-self (//), following, following-sibling, namespace, preceding, preceding-sibling | String functions | string() , concat() , starts-with () , contains() , substring-before () , substring-after() , substring() , string-length () , normalize() , translate() | Boolean functions | lang() | Numeric functions | sum() , floor() , ceiling() , round() | Union operator | | Refer to Chapter 4, "Accessing SQL 2000 via HTTP," to the two sections "Entities in XML" and "Entities in URLs." Remember that depending on where an XPath expression is used, you might have to encode special characters so that they are correctly interpreted. The following URL http://iisserver/VirtualRoot/SchemaVirtualName/Schema File/Orders/ .. will be transformed to http://iisserver/VirtualRoot/SchemaVirtualName/Schema File/ because the ".." in the first URL is interpreted to mean "parent," and the parent of Orders is Schema File. | |