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!

28 comments:

  1. You are awesome! Thanks for posting this!

    ReplyDelete
  2. No problem Aaron, glad I could help you out!!

    ReplyDelete
  3. After following these steps in Windows 7 I received an error when launching xmltidy.exe by itself: Run-time error '429': ActiveX component can't create object

    The solution was to right-click cmd.exe and select 'Run as Administrator' to open up a command console as the Administrator. Then in the command prompt I navigated to the folder with xmltidy.exe and executed the program without issue.

    I also launched Textpad.exe with 'Run as Administrator' for good measure.

    After these one-time initialization steps, I can now run Textpad and XMLTidy as a regular user without the 'Run as Administrator' option.

    ReplyDelete
  4. =\

    I followed the steps above, incl. Vincent's additions, and could not get it to work on Windows 7. Nothing happens to the document, nor am I getting any errors. I'm new to Windows 7, it's the machine at work. None of this requires a restart or something does it?

    ReplyDelete
  5. Thanks a lot for you and also to Vincent who pointed out that admin privileges problem. You saved my time a great deal!!

    ReplyDelete
  6. I found still an issue that XMLTidy couldn't communicate with Textpad. It appeared that after the steps nothing happened but actually the resulting XML was copied into clipboard so all you have to do is after running XMLTidy paste the clipboard content to your Textpad doc. Hope this helps.

    ReplyDelete
    Replies
    1. This cut/paste trick worked (after running as adminsitrator). Still not very elegant.

      Delete
  7. Thanks for posting this, saved me a lot of time!

    ReplyDelete
  8. Thanks so much - XMLTidy stopped working on my new machine and I didn't know why. This saved me a lot of time.

    ReplyDelete
  9. Thanks for this posting. I had to futz with it a little, and finally reinstall Text-Pad again after I had installed the .dll and XMLTidy, but now it works great. This was not intuitive. I appreciate your help.

    ReplyDelete
  10. Thank you... since moving from XP to Windows 7, I really missed this TextPad addon. Now, it's working beautifully again. Thanks !

    ReplyDelete
  11. This is so helpful! I ran XMLTidy and couldn't figure out why it didn't do anything - figured it was just a dud addon. This copmletely solves my problem!

    ReplyDelete
  12. After changing the permissions of the xmltidy.exe and the dll, I'm now at the point where I have to select all the text and do a paste from the clipboard to get the formatted XML. Did anyone get past this where Cntl+1 just works the way it did on my XP system?
    Thanks for your help. The above thread was very useful.

    ReplyDelete
  13. It's likely the file you're dealing with is in read only mode. You can either save the file locally, unclick the "Read" text in the footer, go to configure and unselect read only, or use the keyboard shortcut Ctrl+Q, E

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. You rock. Thanks for posting this valuable info.

    ReplyDelete
  16. thanks a million...i wasted lot of time and i am here... finally...

    ReplyDelete
  17. I was just provided with a new box (has windows 8..). Ive installed textpad along w/ xml tidy (all necessary dlls as well). I had it on my Windows 7 box, and it worked wonderfully. I copied the configuration, file locations exactly as they were on the Windows 7 box. Now, when I try to use XMLTidy, I get the following error: Unable to find XMLTidy. Return code=-2147352567. Then I click 'ok' and I get another error--'Run-time error '429': ActiveX component can't create object.

    Ive read through the blog and have tried all suggestions. What am I missing? Any help is greatly appreciated!

    ReplyDelete
    Replies
    1. Elizabeth, I am getting this same error. Were you able to solve this issue?

      Delete
  18. Elizabeth, I'm sorry but I have no idea how to help here.. If you're able to find a way around the problem, please post another comment so others can find it in the future. Thanks

    ReplyDelete
  19. I am having the same problem as elizabeth. When I downloaded the CAB linked in the article, it refused to unzip as it was 'corrupt', so I downloaded an install from microsoft, which installed the DLL in the SysWOW64 directory. That didn't work, so I moved it. Same issue. I'm stumped.

    ReplyDelete
  20. New machine, was able to open the CAB linked in the article, dropped it in the same directory as the XML Tidy, still, I have the same issue.

    ReplyDelete
  21. Thanks a lot bro...
    I was about to give up when I saw your blog entry. This works good.

    ReplyDelete
  22. Thanks a lot. This worked for me. Definitely had to delete and re-add the Add-On again after adding the VB5 files.

    ReplyDelete
  23. Excellent! I had been searching for a fix all morning. I need to point out this url to the developer!

    ReplyDelete