DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Format XML Files in Shell


xmllint and tidy can both format XML and HTML file. Using their default versions On Ubuntu 14.04, xmllint is more reliable than tidy regarding to indentation correctness and Unicode conversion.

sudo apt install libxml2-utils
xmllint --format input.xml > output.xml

sudo apt install tidy
tidy -xml -i input.xml > output.xml


Published

Feb 14, 2017

Last Updated

Feb 14, 2017

Category

Tech

Tags

  • format 6
  • indent 3
  • shell 46
  • xml 4

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor