*** Welcome to piglix ***

XPath

XPath
Paradigm Query language
Developer W3C
First appeared 1999
Stable release
3.0 / 2014-04-08
Major implementations
C#, Java, JavaScript
Influenced by
XSLT, XPointer
Influenced
XML Schema, XForms

XPath (XML Path Language) is a query language for selecting nodes from an XML document. In addition, XPath may be used to compute values (e.g., strings, numbers, or Boolean values) from the content of an XML document. XPath was defined by the World Wide Web Consortium (W3C).

The XPath language is based on a tree representation of the XML document, and provides the ability to navigate around the tree, selecting nodes by a variety of criteria. In popular use (though not in the official specification), an XPath expression is often referred to simply as "an XPath".

Originally motivated by a desire to provide a common syntax and behavior model between XPointer and XSLT, subsets of the XPath query language are used in other W3C specifications such as XML Schema, XForms and the Internationalization Tag Set (ITS).

XPath has been adopted by a number of XML processing libraries and tools, many of which also offer CSS Selectors, another W3C standard, as a simpler alternative to XPath.

There are several versions of XPath in use. XPath 1.0 was published in 1999, XPath 2.0 in 2007, and XPath 3.0 in 2014. Version 3.1 is at Candidate Recommendation status (as of February 2016). However, XPath 1.0 is still the version that is most widely available.

The most important kind of expression in XPath is a location path. A location path consists of a sequence of location steps. Each location step has three components:

An XPath expression is evaluated with respect to a context node. An Axis Specifier such as 'child' or 'descendant' specifies the direction to navigate from the context node. The node test and the predicate are used to filter the nodes specified by the axis specifier: For example, the node test 'A' requires that all nodes navigated to must have label 'A'. A predicate can be used to specify that the selected nodes have certain properties, which are specified by XPath expressions themselves.


...
Wikipedia

...