Phlip
7/20/2008 1:00:00 AM
> Beside these two libraries mentioned there is also an Hpricot (http://
> code.whytheluckystiff.net/hpricot/) and you should try it to.
Hpricot is a jack-of-all-trades-master-of-some-of-them. Don't look to it for
schema validation, XSLT, or true XPath.
> When dealing with XML you should consider the following questions:
> Who and on what OS the code will be running?
> How big the XML document is?
> Is the speed a decisive parameter?
> What?s the magnitude of manipulation required?
The two XML parser models are DOM and SAX.
DOM converts every tag into an Object (hence Document Object Model), and lets
you traverse the objects. The conversion is slow, and puts the entire document
into memory, simultaneously.
SAX lets you register callbacks to call when an XML reader encounters certain
tags. It treats the input XML as a stream, hence zipping past nodes you don't
need is very fast.
But I don't know the Ruby SAX solution!
--
Phlip