XPath 测试工具
针对 XML 文档测试 XPath 表达式。查询、过滤和提取数据,实时显示结果。
No results. Enter an XPath and click Evaluate.
XPath Quick Reference:
//tag - Select all matching tags
/root/child - Absolute path
[@attr='value'] - Filter by attribute
[position] - Select by position (1-indexed)
/text() - Get text content
/* - Select all children
XPath Tester - 技术详情
XPath (XML Path Language) is used to navigate and select nodes in XML documents. It's essential for web scraping, XSLT transformations, and XML data processing. XPath expressions can select elements, attributes, and text nodes using path-like syntax.
命令行替代方案
# XPath in Python (lxml)\nfrom lxml import etree\ntree = etree.parse('file.xml')\nresults = tree.xpath('//book/title')\n\n# XPath in JavaScript\ndocument.evaluate('//div[@class]', document)