Tuesday, June 1, 2010

TextPad and XML Tidy

I've been using TextPad for general text editing lately. Works quite nicely, no huge complaints (syntax highlighting would be nice, perhaps there's an add-on out there???).

There is an Add-On for Text-Pad named XML Tidy that formats XML documents nicely, taking them from ugly one-line documents to properly tabbed hierarchies. Very cool, this feature is a must for Text-Pad users working with XML documents. I ran into some problems during install on Windows 7 and will note the solution here. First, an install guide:

1. Download XML Tidy from the Text-Pad Add-On page
2. Unzip and put the folder in a permanent location (I chose the existing TextPad install folder)
3. In TextPad, install the Add-On by going to Configure->Preferences and selecting Tools in the tree. Click Add-> Program and select the XML Tidy exe (where you put in in step 2).
4. You will now be able to configure XML Tidy in the same Preferences window. Expand Tools and select XML Tidy. You'll need to change Parameters field to "$Clip $DocWnd" (as per the XML Tidy Readme). Hit OK.
5. You can now run XML Tidy in TextPad by going to Tools->External Tools -> XML Tidy. Note the Ctrl + (number) shortcut, very handy!

At this point you should be excited, as you've installed and configured XML Tidy. Open up your favorite XML document, hit Ctrl + (number) aaaaaand.... Nothing happens. Here lies the issue.

XML Tidy is throwing an error (it's hidden when running in TextPad). Run XMLTide.exe by itself, you'll get the following error in a dialog box:

"The program can't start because MSVBVM50.DLL is missing from your computer. Try reinstalling the program to fix this problem."

XML Tidy requires Visual Basic 5 runtime files, which apparently includes certain DLLs no longer packaged with or are deprecated in Windows 7 (Windows Vista, too? I didn't research it thoroughly). Luckily you can still download the required DLL here. Download and unzip the CAB file (a DLL and an INF file are inside) to the same directory as XMLTidy.exe (the exe will be able to find the DLL if it's located in the same directory).

That should be it! Try running the exe again, you should get a different error that says you need to pass text to the program. Go back into TextPad and try running the Add-On again there. I hope it works for you!