xmllint
XML parser and linter that supports XPath, a syntax for navigating XML trees. More information: <https://manned.org/xmllint>.
Install
- All systems
-
curl cmd.cat/xmllint.sh
- Debian
-
apt-get install libxml2-utils
- Ubuntu
-
apt-get install libxml2-utils
- Alpine
-
apk add libxml2
- Arch Linux
-
pacman -S libxml2
- Kali Linux
-
apt-get install libxml2-utils
- CentOS
-
yum install libxml2
- Fedora
-
dnf install libxml2
- Windows (WSL2)
-
sudo apt-get update
sudo apt-get install libxml2-utils
- OS X
-
brew install libxml2
- Raspbian
-
apt-get install libxml2-utils
- Dockerfile
- dockerfile.run/xmllint
- Docker
-
docker run cmd.cat/xmllint xmllint
powered by Commando
XML parser and linter that supports XPath, a syntax for navigating XML trees. More information: <https://manned.org/xmllint>.
-
Return all nodes (tags) named "foo":
xmllint --xpath "//foo" source_file.xml
-
Return the contents of the first node named "foo" as a string:
xmllint --xpath "string(//foo)" source_file.xml
-
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 source_file.xml
-
Check that an XML file meets the requirements of its DOCTYPE declaration:
xmllint --valid source_file.xml
-
Validate XML against DTD schema hosted online:
xmllint --dtdvalid URL source_file.xml
© tl;dr; authors and contributors