How can I tidy up some XML while keeping the newlines?

HAiDER

New Member
I'm working with some XML files as part of a team. Since some people have different indentation settings, the formatting sometimes gets screwed up, and it's convenient to have an automated tool re-pretty-print the file. Is there a way to pretty-print XML, without deleting all of the newlines in empty lines? These are human-readable/edited XML files I'm working with (Ant scripts, configuration files, a proprietary XHTML-like thing, etc.). The newlines in these files are to break up the text/code flow into blocks, and are really important for making the file easily readable.I'm using EditPadPro as my text editor (and it can use external tools fine), and HTML Tidy as my XML-formatter, but I don't like that it deletes newlines. What tool can I use that will correctly format/pretty-print XML, without deleting newlines?Example annoying XML:\[code\]<thing> <frob> </frob> <!-- Done frobbing; now for BAZ. --> <baz /></thing>\[/code\]Preferred output:\[code\]<thing> <frob> </frob> <!-- Done frobbing; now for BAZ. --> <baz /></thing>\[/code\]
 
Back
Top