Testador XPath

Teste expressões XPath em documentos XML — veja os nós correspondentes instantaneamente

XML Input
Resultados (0)

Testador XPath

Teste expressões XPath em documentos XML — veja os nós correspondentes instantaneamente

Recursos

  • 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

Como usar

  1. Paste your XML document in the left panel.
  2. Enter an XPath expression in the input field.
  3. Click Evaluate or press Enter to see results.
  4. Copy matched nodes using the Copy button.

Dicas e Melhores Práticas

  • 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.

Perguntas Frequentes

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.