The Basics of XML Path Language (XPath)

XPath queries are used to locate and retrieve XML elements, attributes, and their values. XPath's name is derived from its syntactical resemblance to file paths. You can find out more about the XPath standard by consulting the XML standards body on the World Wide Web Consortium at http://www.w3c.org. Because XPath is a standard in its own right, the discussion in this chapter will be limited to the XPath syntax used to address database objects in SQL Server 2000.

The syntax for retrieving the value of a binary column is as follows:

dbobject/TableName[@PrimaryKeyName='PrimaryKeyValue']/@ColumnName.
					

In XPath, the @ symbol (think attribute) refers to an XML attribute. The / character indicates element depth—just ...

Get Microsoft® SQL Server™ 2000 Unleashed, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.