[Haskell-beginners] Laziness and XML parsing

Felipe Almeida Lessa felipe.lessa at gmail.com
Tue Nov 8 03:59:24 CET 2011


On Tue, Nov 8, 2011 at 12:45 AM, Sean Hess <seanhess at gmail.com> wrote:
> I want to parse a large xml file (2GB), without putting the whole thing into
> memory. It's pretty simple with a sax parser in most languages, you just
> stream bytes to the sax parser, and wait for sax events.

I recommend you taking a look at xml-enumerator [1] and
libxml-enumerator [2].  They are the SAX parsers you know from the
imperative world but much easier to write =).  In particular, you
don't need to rely on lazyness.

Cheers,

[1] http://hackage.haskell.org/package/xml-enumerator
[2] http://hackage.haskell.org/package/libxml-enumerator

-- 
Felipe.



More information about the Beginners mailing list