Тестер XPath
Тестируйте выражения XPath на XML-документах — мгновенно видите совпавшие узлы
Ввод XML
Результаты (0)
Тестер XPath
Тестируйте выражения XPath на XML-документах — мгновенно видите совпавшие узлы
Возможности
- Evaluate XPath 1.0 expressions against pasted XML or HTML using `document.evaluate()`
- Native browser XPath engine — same one the developer console uses
- Result types: node sets (snapshot), boolean, number, string — picked automatically
- Common operators supported: child/descendant axes, predicates, function calls (count, contains, …)
- Useful for testing XPaths before using them in scrapers, XSLT, or test selectors
Как использовать
- Paste your XML document in the left panel.
- Enter an XPath expression in the input field.
- Click Evaluate or press Enter to see results.
- Copy matched nodes using the Copy button.
Советы и лучшие практики
- XPath 1.0 is what browsers implement. XPath 2.0/3.0 (with lookup syntax, regex matching, etc.) needs a separate engine like Saxon.
- For HTML input the parser is lenient; for strict XML use the `<?xml` declaration at the top to enable XML mode.
- Namespace handling in XML: declare a namespace resolver function in production code; the tester uses default namespace inference.
- For CSS-style selection in browser tests, prefer querySelectorAll over XPath; XPath shines for tree-walking with axes (`parent::`, `following::`).
- For scraping: XPath is more powerful than CSS but slower; pick the right tool for the structure of the page.
Вопросы и ответы
What is XPath?
XPath (XML Path Language) is a query language for selecting nodes from XML documents. It uses path expressions to navigate elements, attributes, and text.
What XPath functions are supported?
All standard XPath 1.0 functions are supported, including text(), contains(), starts-with(), position(), count(), and more.
Is my data private?
Yes, all evaluation happens in your browser using the native DOMParser and XPath APIs. No XML data is sent to any server.