xmllint

Parse and validate XML

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

Formats, validates and queries XML with XPath.

Common flags
FlagMeaning
--format --formatPretty-print
--xpath --xpathEvaluate an XPath expression
--noout --nooutDo not print the document
Examples
xmllint --format file.xmlPretty-print · explain & risk-check →
xmllint --xpath "//item/@id" file.xmlQuery attributes · explain & risk-check →
Related
jq yq
Open the full explainer →More in Text Processing

Reference text is hand-written and may be incomplete — check man xmllint for your version. Test destructive commands on a non-production system first.