Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative of XML Starlet

Is there any alternative to XML starlet for XML processing in bash? My typical usage is:

  • pretty formatting;
  • selecting data by XPath.
like image 646
Michael Avatar asked Dec 10 '12 08:12

Michael


1 Answers

Take a look at xmllint.

To format xml:

$ xmllint --format file.xml

To evaluate an XPath:

$ xmllint --format --shell file.xml <<< "cat /some/xpath/expression"
like image 168
dogbane Avatar answered Sep 24 '22 23:09

dogbane