[{"data":1,"prerenderedAt":58},["ShallowReactive",2],{"tool-guide:xpath-tester":3},{"overview":4,"whatIs":5,"useCases":6,"steps":12,"commonMistakes":17,"relatedStandards":23,"example":36,"limitations":40,"faq":45},"XPath Tester evaluates XPath 1.0 expressions against XML or HTML documents, highlighting matching nodes and displaying their full paths — all locally in your browser.","XPath (XML Path Language) is a query language for selecting nodes from an XML or HTML document. It uses path expressions to navigate elements, attributes, text, and other node types, similar to how file system paths navigate directories. XPath 1.0 is natively supported by every modern browser through the DOM Level 3 XPath API, which means queries execute locally without any server processing. XPath is used extensively in XSLT transformations, XML Schema validation, web scraping (with tools like Scrapy and lxml), automated testing (Selenium locators), and configuration parsing. Common expressions include element selection (\u002F\u002Fbook), attribute predicates (\u002F\u002Fbook[@category=\"fiction\"]), positional filters (\u002F\u002Fitem[1]), and functions like contains(), count(), and string-length(). This tool parses the input with DOMParser in strict XML or lenient HTML mode, evaluates the expression with document.evaluate(), and presents the results with highlighted source lines, full node paths, and value previews. You can also format the input for readability and copy results with one click.",[7,8,9,10,11],"Debugging XSLT stylesheets — test individual location paths against a source document to verify they select the intended node set.","Writing Selenium locators — prototype XPath selectors against real HTML pages for automated UI tests before embedding them in test code.","Exploring XML APIs — navigate unfamiliar SOAP or REST-XML responses by querying for specific elements, attributes, or text nodes.","Scraping HTML content — test XPath expressions against an HTML page to confirm they extract the intended elements before running a scraping pipeline.","Learning XPath syntax — experiment with axes (child, descendant, ancestor, following-sibling), predicates, and functions interactively against XML or HTML.",[13,14,15,16],"Select XML or HTML mode depending on your input format. HTML mode is lenient and handles unclosed tags; XML mode requires well-formed markup.","Paste the document into the input area, or load a sample. Use the Format button to beautify the input for readability.","Enter an XPath expression such as \u002F\u002Felement, \u002Froot\u002Fchild[@attr], or count(\u002F\u002Fitem). Evaluation runs live after a short pause.","View highlighted matches in the source, or inspect scalar results (string, number, boolean) for aggregate expressions. Copy input or results with the Copy button.",[18,19,20,21,22],"Forgetting the double slash — \u002F\u002Fbook searches the entire document, while \u002Fbook only matches a root-level \u003Cbook> element.","Case sensitivity in HTML mode — HTML elements are uppercased in the DOM, so use \u002F\u002FBODY or \u002F\u002FDIV, or use the translate() function for case-insensitive matching.","Confusing XPath 1.0 with 2.0+ — browser-native evaluation supports XPath 1.0 only. Functions like matches(), lower-case(), and if\u002Fthen\u002Felse are XPath 2.0+ and will cause errors here.","Using text content without text() — \u002F\u002Ftitle returns element nodes; \u002F\u002Ftitle\u002Ftext() returns their text node children. The distinction matters when extracting values.","Predicate indexing starts at 1 — \u002F\u002Fitem[0] never matches; the first item is \u002F\u002Fitem[1].",[24,27,30,33],{"title":25,"url":26},"W3C — XPath 1.0 Specification","https:\u002F\u002Fwww.w3.org\u002FTR\u002Fxpath-10\u002F",{"title":28,"url":29},"MDN — Document.evaluate()","https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FDocument\u002Fevaluate",{"title":31,"url":32},"MDN — Introduction to using XPath in JavaScript","https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FXPath\u002FIntroduction_to_using_XPath_in_JavaScript",{"title":34,"url":35},"W3C — XML Path Language (XPath) 3.1","https:\u002F\u002Fwww.w3.org\u002FTR\u002Fxpath-31\u002F",{"label":37,"input":38,"output":39},"Select fiction titles","\u002F\u002Fbook[@category=\"fiction\"]\u002Ftitle","\u003Ctitle lang=\"en\">The Great Gatsby\u003C\u002Ftitle>\n\u003Ctitle lang=\"en\">1984\u003C\u002Ftitle>",[41,42,43,44],"Only XPath 1.0 is supported — the browser does not implement XPath 2.0+ features like regular expressions, conditional expressions, or sequence types.","Namespace handling depends on the document — elements in a default namespace may require an explicit prefix or custom resolver.","In HTML mode, element names are uppercased in the DOM (e.g., \u002F\u002FDIV not \u002F\u002Fdiv) because the browser normalizes HTML tag names.","Results are limited to 1,000 matching nodes to keep the UI responsive on large documents.",[46,49,52,55],{"question":47,"answer":48},"Which version of XPath does this tool support?","XPath 1.0, evaluated natively by the browser DOM API. XPath 2.0+ functions and syntax are not available.",{"question":50,"answer":51},"Is my data uploaded to a server?","No. The document is parsed and the XPath expression is evaluated entirely in your browser. Nothing is sent over the network.",{"question":53,"answer":54},"Can I use this with HTML?","Yes. Switch to HTML mode for lenient parsing that handles unclosed tags and missing quotes automatically. Note that HTML element names are uppercased in the DOM, so use \u002F\u002FDIV instead of \u002F\u002Fdiv in your expressions.",{"question":56,"answer":57},"Why does my expression return no results?","Common causes: in HTML mode, element names must be uppercase (\u002F\u002FDIV not \u002F\u002Fdiv); in XML mode, namespaces may require a prefix or local-name() predicate; tag names are case-sensitive; or the expression uses XPath 2.0+ syntax not supported by the browser.",1788952484362]