xmlpretty-printprettify

format xml, pretty print


I know of two ways to "pretty print", or format, xml:

  1. shell tools
  2. Hack 38 Pretty-Print XML Using a Generic Identity Stylesheet and Xalan

what other free (as in beer) formatters are there? (aside from using javascript)


Solution

  • Well, the identity transform you linked to is portable to any XSLT processor (Saxon, msxml, etc).

    Additionally, you could look at xmllint which is part of the LibXML2 toolkit. The --format option allows you to pretty print the input. Similar functionality exists in XMLStarlet (which uses LibXML2 under the hood iirc).