How to test an XPath expression
- Paste your XML.
- Type an expression. Matches update as you type.
- Or press Pick element and click one to get its path.
Examples
| Expression | Result |
|---|---|
//order[total>50] | Orders with a total above 50 |
/orders/order[2]/@id | The id of the second order |
count(//order) | Number of orders |
sum(//total) | Sum of all totals |
Default namespaces
XPath 1.0 does not apply a default namespace to unprefixed names. In this tool, use the prefix d:, for example //d:item. If a document declares several default namespaces, d: refers to the first one found.
Questions
Is XPath 2.0 or 3.1 supported?
No. The tool uses your browser’s XPath 1.0 engine.
How large can the element tree be?
The tree lists up to 2,000 elements.