Parse and validate XML
low risk
Formats, validates and queries XML with XPath.
| Flag | Meaning |
|---|---|
--format --format | Pretty-print |
--xpath --xpath | Evaluate an XPath expression |
--noout --noout | Do not print the document |
xmllint --format file.xmlPretty-print · explain & risk-check →xmllint --xpath "//item/@id" file.xmlQuery attributes · explain & risk-check →Reference text is hand-written and may be incomplete — check man xmllint for your version. Test destructive commands on a non-production system first.