XML and the SQL 2000 Server part 3: XML Data with XPath Queries - Exporting Schema and Query in URL
(Page 7 of 8 )
Exporting the XDR Schema
Once the Xpath query verification is finished, you can save the project and export the XDR file by right clicking on the .smm file, or from Tools->Export XDR Schema..., which produces an XML document. Now you save this document in the Schema folder of the SQL 2000 Server specific virtual directory discussed in Part 1. The Xpath queries can now be executed by including them in the URL, or by including them in a template file.
The syntax for specifying an Xpath query in an URL is as follows: http://IISServer/VirtualRoot/SchemaVirtualName/ SchemaFile/XPathQuery[?root=ROOT] For the virtual directory settings shown above this will be: http://XPHTEK/TestPath/xschema/TestWizView.xml/color?root=root. The browser display for this query is shown in the next picture. The TestWizView.xml file[produced by the XML Viw Mapper] is saved in the c:\TestXPath \xschema folder. This query returns all the elements from the color table
If the query returns a single record, then it can be made to return an xml document by issuing the following query: http://XPHTEK/TestPath/xschema/TestWizView.xml/color[@colid=2] The Xpath query is color[@colid=2].This would then result in the following returned result shown in this picture.