Monday, February 22, 2010

Notepad++ and XML Formatting

I downloaded Notepad++ to use as part of my development environment. I like the convenience of the app. It works a thousand times better than the regular notepad that comes with windows and it also does things that you would not expect from a name Notepad.

I guess when the mind thinks notepad, we think limited app.

Anyway, lately I've been working with lots of XML inside of a table. I've been copying xml files and pasting them into Visual Studio and working from their. But VS 2008 takes a long time to load and all I want to do is look at the XML file and code against it.

So I opened Notepad++. This is when I ran into a problem. The text pasted as one long string on line 1.

I searched for a method for formatting the xml. The web suggested Tidy. I downloaded the command line tidy.exe and that was out of scope. I didn't want to use two apps to accomplish formatting text, so I did additional searches and discovered that, in the new addition of Notepad++, tidy is included. That is version 5.6.6.

This is how to format your XML files.
In Notepad++ choose
> TextFX
> HTML Tidy
>Tidy Reindent XML

and the beauty of a thing is revealed.

No comments: