SAX Parsing is annoying, SAXMachine makes it much less so

We’ve all been there. Gigantic XML file in need of parsing, regular DOM parsing exploderates RAM usage beyond any hope of completion, contemplating writing a SAX parser, and suicide.

Before you solve your XML parsing woes permanently, take a look at SAXMachine. It’s a Ruby DSL for SAX parsers.  It’s built on top of Nokogiri, which is already stupid fast and easy, and it makes writing a SAX parser so much easier.

I’m not going to give you an example, the README from the above link does a good enough job explaining.  For me, it took what had promised to be a multi-days long code spelunking odyssey and turned it into a few hour long errand. Bliss.

Just go read about it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s