XPath Tester
Free online XPath tester tool, query XML documents
What is XPath?
XPath (XML Path Language) is a query language for selecting nodes from XML documents. It is used in XSLT, web scraping, configuration parsing, and XML data extraction. XPath expressions navigate the XML tree using paths like /root/element[@attr='value'].
How to Test XPath Expressions
Paste your XML in the input area. Enter an XPath expression and click Evaluate. The tool shows matching nodes and their values. Common expressions: //element selects all elements, //@attr selects all attributes, //book[price>30] uses predicates.
▶What is the difference between / and //?
/ selects from the root node or creates absolute paths. // selects nodes anywhere in the document regardless of their location. Use /bookstore/book for direct children and //book for any book element.
▶Can I use XPath with HTML?
XPath works with well-formed XML. Most modern HTML can be parsed as XML/XHTML. For web scraping, browser developer tools support XPath queries on live HTML.
▶How do I select elements by attribute?
Use //element[@attribute='value'] to select elements with a specific attribute value. Use //element[@attribute] to select elements that have the attribute regardless of value.