Saturday, March 26, 2011

Tidy up XML with Perl

I've really been trying to hone my Python skills and thought this would be a great opportunity to take on a small task and do just that. But after having a difficult time finding documentation and examples that were worth anything for TidyLib, I resorted to my weapon of choice - Perl. Working on another project, I just wanted something to properly indent insanely long strings of XML. The small script can be found on GitHub: https://github.com/davidcollins4481/MyTools/blob/master/XMLTidy.pl

Being a Linux and Gnome user, I added support for it to be used as a nautilus script. Throw it in ~/.gnome2/nautilus-scripts and you can right click on a file and tidy it up without having to open up the command-line.

No comments:

Post a Comment