Free XML Formatting tool
You can open the XML file in any Visual Studio Express product and the press Ctrl+A, Ctrl+K, Ctrl+F to get it nicely formatted.
Hey, it's free and it's a tool, so it fits the question. :-)
Firstobject's free XML editor for Windows is called foxe is a great tool.
Open or paste your XML into it and press F8 to indent (you may need to set the number of indent spaces as it may default to 0).
It looks simple, however it contains a custom written XML parser written in C++ that allows it to work efficiently with very large XML files easily (unlike some expensive "espionage" related tools I've used).
From the product page:
The full Visual C++ source code for this firstobject XML editor (including the CDataEdit gigabyte edit control MFC component) is available as part of the Advanced CMarkup Developer License. It allows developers to implement custom XML handling functions such as validation, transformation, beautify, and reporting for their own purposes.
I believe that Notepad++ has this feature.
Edit (for newer versions)
Install the "XML Tools" plugin (Menu Plugins, Plugin Manager)
Then run: Menu Plugins, Xml Tools, Pretty Print (XML only - with line breaks)
Original answer (for older versions of Notepad++)
Notepad++ menu: TextFX -> HTML Tidy -> Tidy: Reindent XML
This feature however wraps XMLs and that makes it look 'unclean'. To have no wrap,
- open
C:\Program Files\Notepad++\plugins\Config\tidy\TIDYCFG.INI
, - find the entry
[Tidy: Reindent XML]
and addwrap:0
so that it looks like this:
[Tidy: Reindent XML] input-xml: yes indent:yes wrap:0
Use the following:
xmllint
--format