Differences from W3C Specification


The Microsoft implementation of XPath differs from the W3C specification in the following ways:

  • Root queries. The root query (/) is not supported in SQL Server 2000 XPath queries. Every XPath query must begin at a top-level <ElementType> in the schema. The slash mark can, however, be explicitly placed in front of the beginning <ElementType> .

  • Reporting errors. The W3C XPath specification has no provisions to cover error conditions. The only thing returned from an invalid XPath query or another error condition is an empty node set. In SQL Server 2000, a query might return many different types of error messages. I'm sure that in your experimentation with queries up to this point, you've come across an error or two.

  • Document order. Document order in SQL Server 2000 is not always deterministic, so document order specifications are not implemented.

    This shortcoming also means that the string value of a node can be evaluated only when that node maps to a single column in a single row. An element with subelements or an IDREFS or NMTOKENS node cannot be converted to a string.

  • Data types. Microsoft's implementation of the string, number, and Boolean data types is limited. These limitations are discussed in the section "XPath Data Types" later in this chapter.

  • Cross-product queries. Cross-product XPath queries are not supported. An example of this is Customer[Order/@OrderDate=Order/@ShippedDate] . This produces a node set of all customers with any order for which the OrderDate equals the ShippedDate of any order.

However, this type of query is supported: Customer[Order[@OrderDate= @ShippedDate]] . This selects customers with any order for which the OrderDate equals its ShippedDate .

That summarizes the differences. Now let's examine XPath data types and various conversions along with how XDR data types map to XPath data types. Then we'll start working with the syntax.



XML and SQL Server 2000
XML and SQL Server 2000
ISBN: 0735711127
EAN: 2147483647
Year: 2005
Pages: 104
Authors: John Griffin

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