The Misadventures of Dan

Peer into the mind of Dan as he tries to build an MP3 Player for his PDA and searches for the next thing in his life be it an electrical engineering job or graduate school.

Friday, August 27, 2004

.:2:24:45 PM:.

XML Source Formatting

I think I've mentionned Editplus before but in case I haven't, it's a great text-editing program! Though it's not free it's not very expensive either. The best part is that you can tie it in with other programs.

Over the past few months I've had to work a lot with Flash and XML files and when flash outputs an xml object it's as one long string with no line breaks. After a bit of googling I found out about Tidy. Tidy seems to first have been created to format your HTML and make it "pretty"-that is put line breaks in, wrap some of your text, close the unclosed tags, etc. etc. Because HTML is structured like XML it wouldn't be that hard to extend it to XML formatting. Before we used to create the xml file then use Dreamweaver's Source Formatting to see what the structure looked like and since we did a lot of our editing in EditPlus and switched back to Dreamweaver-all I can say is NOT GOOD!

So here's how we integrated XML source formatting with Editplus and Tidy:

  1. Get Editplus
  2. Get Tidy (the binary)
  3. Install both and put tidy into a directory like C:\tidy (Apparently the directory path CAN'T contains any SPACES so C:\tidy\tidy.exe is ok c:\program files\tidy\tidy.exe IS NOT.
  4. Launch Editplus
  5. Goto Tools, Configure User Tools
  6. Click on "Add Tool"
  7. Select Program from the list
  8. Fill in the following:
    Menu Text:tidy Command:C:\tidy\tidy.exe Argument:-config C:\tidy\tidyconfig.txt $(FileName) Initial Dir:$(FileDir)
  9. Click OK
  10. Goto the directory that tidy.exe is in and copy the settings listed below into a file called tidyconfig.txt
// tidyconfig.txt
// Config file for xml formatting
doctype: omit
char-encoding: raw
output-xml: yes
write-back: yes
indent: yes
wrap: 0
//indent-attributes:yes
quiet: yes
tab-size: 4
vertical-space: yes
input-xml: yes

To test it open up an xml file in Editplus and then click on Tools... Tidy. A window should popup asking you to press any key and then another window will open up informing you that changes have been made (the new formatting)


Sunday, August 22, 2004

.:9:03:17 PM:.

Batch file renaming

When you have to rename one or two files it's not too bad however when you start renaming 40 or 100... it starts to get on you. So while looking for a Perl solution I came across this free windows program called Ant Renamer.


home | archives