XML without whitespaces not human readable

To save storage and network bandwidth, XML documents are sometimes provided without whitespaces. This makes it hard for an average user to read and understand the content of the document. A tool to add this whitespaces again and pretty print the document would be helpful. Also it would be nice to be able to collapse certain hierarchy levels, to focus on the areas you want to read.


1 answer

Use Notepad++ to view and edit XML documents

Notepad++ is a free source code editor and Notepad replacement that supports several formats. In its basic edition it can already do some nice things like:

  • collapse structured texts like XML on a certain hierarchy level with the key combination "Alt"+X, where X is a number between 1 and 8. Uncollapse with "Shift"+"Alt"+X.
  • Extended search and replace with e.g. line breaks or search and replace using regular expressions.
  • Vertical selection and simultaneous editing of text holding down the "Alt" key.
  • and many more...
  • If you download the XML Tools Plugin you can also pretty print XML documents without witespaces. Just select it from the plugins menu or use the keyboard shortcut "Ctrl"+"Alt"+"Shift"+"B". Check out also the other features provided with the plugin.