XPath is the XML Path Language for defining how a specific element in a XML document can be located. It's sort of like the '#' convention in HTML URLs but for XML.

XPath is a defines a syntax and specification for addressing different parts of an XML document. It can also be used to address functions in a library.

An XPath expression, when evaluated, results in a set of nodes, a boolean, a number, or a string. XPath expressions are evaluated in a context, which in most cases will be some node (the context node), but which can also be a namespace, a function library, a set of variable bindings, or a pair of non-zero integers (context position and size).

The context is usually determined by the system doing the processing; a XSLT processor for instance.

The nodes in this metanode will sometimes refer to this document fragment to provide some examples:

<zoo>
<animals>
<dog breed="collie">
<cat breed="tabby">
</animals>
<people>
<person name="John" job="keeper">
<person name="Amy" job="vet">
</people>
</zoo>

Nodes:


Most of this information is condensed from the XPath specs at http://www.w3c.com/TR/XPath and from articles on http://www.xml.com/.

Log in or register to write something here or to contact authors.