XPath

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

XML Path Language (XPath) is a language used to create expressions that can address parts of an XML document, manipulate strings, numbers, and Booleans, and can match a set of nodes in the document. XPath is used by both XSL Transformations (XSLT) and XPointer, and models an XML document as a tree of nodes of different types, including element, attribute, and text. XPath expressions can identify these nodes in the XML document based on their type, name, and values, as well as the relationship of a node to other nodes in the document. An XPath expression yields one of the following basic objects:

  • node set
  • Boolean
  • number
  • string

For example, the query "find 'author' elements that have a 'period' attribute with the value 'classical', and that are contained in the 'authors' element at the document root" can be expressed as in XPath expression as "/authors/author[@period='classical']".

These simple expressions are a core part of XSLT transformations, which associate the expression results with templates to create a new XML document. Expressions using the XPath syntax can also be performed directly against the XML Document Object Model (DOM).

An important kind of XPath expression is a location path, which is an expression that selects a set of nodes relative to the context node. The result of evaluating location path is a node-set containing the selected nodes.

The Microsoft XML Parser (MSXML) for Windows Embedded CE implements XPath as described in the XML Path Language (XPath) Version 1.0 Worldwide Web Consortium (W3C) recommendation dated November 16, 1999.

This section contains the following topics:

Community Additions

Show: