Rant/Rave: Parsing XML

The forum for ranting, raving, complaining and praising
Post Reply
User avatar
TheoSqua
Next Gen Wart
Posts: 8951
Joined: April 22 06, 6:53 pm
Location: St. Louis
Contact:

Rant/Rave: Parsing XML

Post by TheoSqua »

Rave: Learning to write/parse XML is freaking awesome. Automating stuff saves so much time and i feel like i actually almost know how to do some programming stuff. Wee!

Rant: Now that I've been working on these parsing scripts for like a month, every time I run across something that might be potentially tedious my first thought is how I could write a script that would parse the data for me automatically, even if writing the script would take 3x longer than just doing it manually.

User avatar
StatmanCrothers
Perennial All-Star
Posts: 6461
Joined: April 17 06, 6:50 am
Location: Boston burbs
Contact:

Re: Rant/Rave: Parsing XML

Post by StatmanCrothers »

can you give an example of something you've used it for? :-k

User avatar
TheoSqua
Next Gen Wart
Posts: 8951
Joined: April 22 06, 6:53 pm
Location: St. Louis
Contact:

Re: Rant/Rave: Parsing XML

Post by TheoSqua »

when you go to commerce bank to view the rates, there's 25 XML files that have the rates for each region the bank offers CDs to. There's a big array of zip codes, and depending on the zip code you put into the form, it spits out one of the xml files.

CD Specials/Promotions are for the entire bank, not regional, so we used to just hard-code the specials on top of the data that came from the XML files so that we only had to change the specials once, and not copy/paste them 25 times. But we're making some changes to the CDs rates because we're going to allow online applications for CDs. So I had to write in the CD Specials into each XML file so the data can be pulled from a server that I won't have access to hard-code to and then rewrite the XSL (the template that converts the xml into html) so that it will write the HTML for the cd specials.

Then the line of business people complained because they didn't want to have to put the specials into the files 25 times instead of once, so I wrote a script that takes a list of files in a directory, combines each file with the xml data for the specials, then resaves the files.

User avatar
New Pagodi
Perennial All-Star
Posts: 4219
Joined: April 18 06, 11:30 pm
Location: St. Louis
Contact:

Re: Rant/Rave: Parsing XML

Post by New Pagodi »

When I built my pitch fx database, I used the GOLD parser. It works pretty well and comes with a nice gui capable of detecting ambiguities and other problems in your parser. The only problem is that changing the grammar slightly can wreck the parser if your not careful. I kept meaning to write a program to automate importing the changes, but I never got around to it.

User avatar
AdmiralKird
MBA, CPA, CFA, CFP, JD, PE, MD
Posts: 10178
Joined: March 7 07, 4:50 pm
Location: Tycho Crater, Luna

Re: Rant/Rave: Parsing XML

Post by AdmiralKird »

Should I have sex or Parse XML tomorrow night? ...I just can't decide.

Post Reply