views:

119

answers:

2

I have a whole lot of XML files, badly indented.

I wish to write a script or use a tool which re-indents all the files.

Is there such a tool, or a nice library in a mainstream scripting language (preferred are Ruby and Python), or in Java ?

+1  A: 

You are looking for an XML pretty printer.

Here is an online tool, that uses xmlpp under the hood.

Oded
+1  A: 

Here's a large list of options to do it:

http://www.dpawson.co.uk/xsl/sect2/pretty.html#d8578e19

The main ones that I'd use are the xslt stylesheet, or HTML Tidy.

Kyle Butt