Query Is Key

An XML document is primarily a repository of information and as such must be searchable. But how? XPath was the first answer to the demand for a query tool to extract node-sets out of XML documents. But more powerful tools are needed. Today, XPath 2.0 is on the way, with XQuery 1.0 running close behind.

XPath as we know it today, and as supported by the .NET Framework, is a language for addressing parts of an XML document. XPath 2.0 presents itself as an expression language for processing sequences of text. It also comes with built-in support for querying XML documents. But what’s the difference between addressing and querying? And between XPath and XQuery?

I think that the difference between addressing and querying can be summarized by resorting to a SQL metaphor. A simple SELECT statement with a WHERE clause addresses a subset of rows; a more complex SELECT statement that includes UNION, GROUP BY, INNER JOIN, and temporary tables does much more and actually performs a query.

XPath 1.0 addresses parts of the documents; XQuery performs complex queries and supports more data types. From a syntax point of view, XPath 2.0 is a subset of XQuery but with a number of key features already included. Stepping from XPath 1.0 to XPath 2.0 positions you nicely for a further jump to XQuery when it becomes a W3C recommendation.

A good reference for clearing up any confusion you might have about XPath and XQuery is the following: http://www.xml.com/pub/a/2002/03/20/xpath2.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.223.123