XPath Tester

Evaluate XPath queries on XML documents and inspect matched nodes and attributes.

100% Free · No Sign-up · Runs in Your Browser

About the XPath Tester

XPath (XML Path Language) is a powerful query language for selecting nodes and values from XML documents. Crafting complex XPath expressions with predicates, attribute filters, and axes often requires rapid testing against real XML samples. This XPath Tester evaluates XPath expressions in real time.

This tool is essential for web scrapers using Scrapy or BeautifulSoup, automated QA engineers writing Selenium test selectors, and enterprise developers building XSLT transformations. It supports element selectors ('//book/title'), attribute queries ('//user[@status="active"]'), positional indexing ('/catalog/item[1]'), and value filtering ('//price[text() > 20]').

To use it, paste your XML document in the left box, enter your XPath query in the expression field, and click 'Evaluate XPath'. All matching XML elements, attributes, or text values are displayed in a clean list with match counts.

For example, running '//book[price < 35]/title' on a catalog returns only the title nodes of books costing less than $35.

A frequent XPath mistake is forgetting that XPath index numbering starts at 1, not 0. '/root/item[1]' selects the first item element.

Tip: You can extract raw text content by appending '/text()' to your XPath query, or extract attribute values using '/@attributeName'.

Frequently Asked Questions

Q.What version of XPath is supported?

It supports standard XPath 1.0 queries natively supported by modern web browser DOM engines.

Q.Can I query attributes with XPath?

Yes, use the '@' symbol (e.g. //user/@email) to target specific attribute values.

Q.Is my XML document sent to any server?

No, all XPath evaluation executes client-side using browser XPathEvaluator APIs.

Related Tools