Sequential XML parsing with xml.sax

peter at hardy.dropbear.id.au peter at hardy.dropbear.id.au
Tue Aug 23 21:29:39 EDT 2005


Hi.

Fredrik Lundh wrote:
> peter at hardy.dropbear.id.au wrote:
>
> > The API reference isn't clear on whether parseString can only handle
> > discrete bits of valid XML
>
> the documentation says that "parse" expects an XML document,
> and that "parseString" is the same thing, but parses from a buffer.

OK, so it sounded a lot more ambiguous at 4am. :-)

> it's probably easier to pass a BZ2File instance to "parse",

It is easier to retrieve a remote file, and decompress and parse as
separate steps. But I've been wondering if it would be faster / more
efficient to do it without caching.

> but if you
> insist on doing incremental SAX parsing, the IncrementalParser class
> might be what you need:

That'll do the trick nicely. Thanks.

Cheers,
-- 
Pete




More information about the Python-list mailing list