The primary purpose of XPath is to address parts of an XML document. It also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax. XPath operates on the abstract, logical structure of an XML document, rather than its surface syntax.

XPath is the result of an effort to provide a common syntax and semantics for functionality shared between XSL Transformations XSLT and XPointer.

The primary purpose of XPath is to address parts of an XML document. In support of this primary purpose, it also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax to facilitate use of XPath within URIs and XML attribute values. XPath operates on the abstract, logical structure of an XML document (for example XDM, or DOM), rather than its surface syntax. XPath gets its name from its use of a path notation as in URLs for navigating through the hierarchical structure of an XML document.

Besides XSLT and XPointer, XPath is now used in other host languages such as XQuery, XML Schema, Schematron, and Selenium.


What is XPath?

  • XPath is a syntax for defining parts of an XML document.
  • XPath uses path expressions to navigate in XML documents.
  • XPath contains a library of standard functions.
  • XPath is a major element in XSLT.
  • XPath is a W3C recommendation.

enter image description here

Tools

The XPath Visualizer is a local HTML and JavaScript application for teaching XPath 1.0 by example. Just load your XML file, repeatedly enter any XPath expression and immediately see the result highlighted in the XML document (if node-set) or in a separate dialog box (otherwise).

Online tools include BIT-101 XPath Query Tool, FreeFormatter.com and this validator made by Chris Nielsen.


Browser Addons

  1. xPath Analyzer Google Chrome Addons - Chrome Webstore
  2. XPath Checker Mozilla Firefox Addons - Firefox Addons

Online Tutorial


Online Training

  1. A 70-minutes "Crash Course in XPath" module is available as part of the Pluralsight video-course "XSLT 2.0 and 1.0 Foundations"

  2. "The Evolution of XPath: What’s New in XPath 3.0" -- A Pluralsight video-course (4.5h)


External links