This third article in the series on using XML with SQL Server 2000 covers more information on using Xpath quesries. Jayaram Krishnaswamy writes about using the XML View Mapper to create XML views to use in Xpath queries and how to use Xpath queries with the database.
In Part 1, I discussed the infrastructural details for accessing data from SQL 2000 Server using XML over HTTP. Also I discussed the T-SQL language extensions for facilitating data access using XML. Part 2 focussed on the practical aspects of querying over HTTP, in particular, using URL queries and template queries for both SQL Stataments. I also spoke about stored procedures for data access.
In this tutorial, yet another way of accessing data with Xpath queries will be my topic of discussion. SQL 2000 server's support for XDR schemas provide the ability to specify Xpath queries against these schemas. In order to facilitate the derivation of these XDR schemas, Microsoft also provides an XML tool: XML View Mapper (not bundled with SQL 2000 Server, but a separate download). The bulk of the tutorial is about the basics of using this tool to create XML views that can be used in Xpath queries and using Xpath queries to query the database. For the purposes of discussion, a very small database is chosen to make the screen shots more viewer friendly. It may be helpful to review parts 1 and 2 referenced above as well as visit the w3c site to get a good understanding of the Xpath basics and syntax.