Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

lachoy (1663)


I am actually Chris Winters; I am actually living in Pittsburgh, Pennsylvania, USA; I am actually married and have three cats. (Guess what one of them is named?) I am the "OpenInteract" guy, which could be good or bad.

Journal of lachoy (1663)

Thursday March 02, 2006
03:17 PM

More on XML with JavaScript: JSXML does in a pinch

[ #28848 ]

About two months ago I posted a note about browser-side XML parsing with JavaScript. At the time I didn't find anything directly useful and just created a standard stupid-simple one myself. As you'd expect the fragility of such a system made itself a nuisance -- it worked fine for a while, and had the benefit of being 100% on-target for my needs, but when the incoming message changed a bit (requiring a CDATA section instead of an attribute) the solution didn't scale so well.

So with irrational optimism I went back to google and found the same crappy stuff. (Why does everyone want to redo the same contrived machinations with DOM?) But in a dojo post I found a reference to JSXML, a cross-browser library that includes REXML, using regular expressions to parse a document. While it hadn't been updated ina while it touted speed as a feature and the code was fairly small.

Plugging it in was a piece of cake and amounted to building my useful object from the tree of parsed objects instead of as-you-go. It may be less efficient[1], but it's much easier on me.

[1] While the REXML boasts about being super-speedy, it also hasn't been updated in four years. Browsers may have made strides in XML parsing since then.

Posted from; read original

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.