xq

Beautify and extract data from XML and HTML documents in the terminal

brewmacoslinux
Try with needOr install directly
Source

About

Command-line XML and HTML beautifier and content extractor

Commands

xq

Examples

pretty print XML file with indentation$ xq . file.xml
extract specific element from XML document$ xq '.root.element' file.xml
parse and format HTML file$ xq . file.html
extract text content from XML tags$ xq '.root.item | .text' file.xml
convert XML to JSON format$ xq -r . file.xml | jq .