>_devtools

XPath Tester

Run XPath 1.0 expressions against XML with namespace prefixes; see nodes, strings, numbers, or booleans.

What this does

Evaluates an XPath 1.0 expression against an XML document using your browser's XPath engine and shows the result. Node-sets list each node with its kind, its position path, and its value; other expressions show a string, number, or boolean.

Examples

  • //book[@id='b1']/title selects a title element.
  • count(//book) returns a number.
  • //book/@id selects attribute nodes.
  • boolean(//book[price > 5]) returns true or false.

Namespaces

XPath 1.0 cannot match elements in a default namespace without a prefix. Prefixes declared in the document are picked up automatically, and the default namespace is bound to d, so use //d:book for <book xmlns="urn:x">. You can edit or add prefixes in the table.

Limits

Browsers implement XPath 1.0 only: no XPath 2.0 or 3.x functions such as matches() or for expressions. At most 1000 nodes are listed.

Privacy

Everything runs in your browser. Your input is never uploaded, stored, or put in the URL.