I’ve been testing a few REST and SOAP web services API and all of them were returning XML in raw and unformated form. These data, while correct, were hard for any normal human to go through and make sense out of it. Instead of just reading this raw data, what I did was copy and paste it into another application so that I can read it properly.
There are a few application that reindents XML for you but I will only introduce 2 of them that I’ve found the easiest to use.
Notepad++ is free and comes with a built in plugin that helps you reindent xml data. Copy and paste any raw xml data into Notepad++, goto TextFX > TextFX HTML Tidy > Tidy: Reindent XML and that’s it!
update 2012-07-17: Newer versions of Notepad++ and TextFX seems to be missing the TextFX HTML Tidy > Tidy: Reindent XML menu. A new solution is to install the XML Tools plugin in plugin manager so you can use Plugin > XML Tools > Pretty Print to tidy up your xml.
XMLMarker is free and deals specifically with XML. I think the application view is simply brilliant and allows you to glance at all the nodes and data in a easy to understand way. Simply copy and paste any raw xml data into XMLMarker and press the box highlighted in the picture below and your xml data will be reindented and formated perfectly.
Some people might say that you can see all those xml nodes by setting up the debugger and breaking after the REST request or SOAP request. That’s doable but still, that would mean going through the code and setting a breakpoint everytime you want to examine a similar request. Why don’t just save a copy and investigate the xml anytime you want? For me, that’s a no-brainer.
So there you have it. I find that Notepad++ reindent ain’t perfect and XMLMarker does a better job in reindenting the xml that I’ve passed in for it to format. These two application is free and if you’re considering getting a more advance level xml editor such as Oxygen XML, you can at least start from here before committing into something costly.