XML formatting using xmllint

XMLs can come in varying shapes and sizes and often we encounter XMLs which are not formatted and hence not easy on the eye. We used to write emacs macros to format these ugly ones, but not any more. Because xml lint is here and is so easy to use in Ubuntu.


xmllint is pre-installed in Ubuntu. To make a good looking and readable XML, use:

xmllint -format ugly.xml -output pretty.xml

Just used it to read a one line, pretty huge XML file from Microsoft and converted into a pretty one :) !