xmllint
XML parser and linter that supports XPath, a syntax for navigating XML trees. More information: https://manned.org/xmllint.
- Return all nodes (tags) with a specific name:
xmllint --xpath "//"
- Return the contents of the first node with a specific name as a string:
xmllint --xpath "string(//)"
- Return the href attribute of the second anchor element in an HTML file:
xmllint --html --xpath "string(//a[2]/@href)" webpage.xhtml
- Return human-readable (indented) XML from file:
xmllint --format
- Check that an XML file meets the requirements of its DOCTYPE declaration:
xmllint --valid
- Validate XML against DTD schema hosted online:
xmllint --dtdvalid
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
