Friday, January 25, 2008

Reformat XML with XML Spy

If you wouldn't think of IntelliJ when looking for an XML editor, think again: IntelliJ is a great XML editor. As a matter of fact, it has been my XML editor of choice many year now.

But I have to admit: IntelliJ isn't perfect; in particular, it is very slow at reformatting XML on large files. Say you have a document that weighs a few MB and you want to reformat it to make it more readable. This happens to me frequently when dealing with XML generated by Microsoft Word, which likes to put pretty much everything on a single line. Going through a few MB of XML all in one single line not what I would describe as an enjoyable experience. So here is the trick:

  1. Open your large XML file in XML Spy, reformat it, and save it.
  2. Open the newly formatted file in IntelliJ (or your favorite editor).
XML Spy is able to reformat large XML files in a breeze. So refreshing!

1 comment:

Jerry Sheehan said...

Nice post! When you decide to move to Office 2007, XMLSpy 2008 also includes support for the new xml format Office Open XML If you don't have a license for the latest edition, you can request one after downloading and launching the software the first time. See also the blog post Tips & Tricks for large files