Edit online

XPath is a language for addressing specific parts of a document. XPath models an XML document as a tree of nodes. An XPath expression is a mechanism for navigating through and selecting nodes from the document. An XPath expression is, in a way, analogous to an SQL query used to select records from a database.
Note: If an XPath expression is run over a JSON document, it is converted to XML and the XPath is executed over the converted XML document.

There are various types of nodes, including element nodes, attribute nodes, and text nodes. XPath defines a way to compute a string-value for each type of node.

XPath defines a library of standard functions for working with strings, numbers and boolean expressions.

Examples:

  • child::* - Selects all children of the root node.
  • .//name - Selects all elements having the name "name", descendants of the current node.
  • /catalog/cd[price>10.80] - Selects all the cd elements that have a price element with a value larger than 10.80.

To find out more about XPath, see http://www.w3.org/TR/xpath.