[lxml-dev] XmlTextReader support
Stefan Behnel
stefan_ml at behnel.de
Mon Nov 17 20:21:26 CET 2008
Hi,
Roy, Remy wrote:
>> No, but I always take patches. May I ask why iterparse() doesn't suite
>> your needs?
>
> From my understanding, iterparse does not work well with streams which
> is what I need to work with large xml content.
Who told you that? You can parse from any file-like object, you just have
to care for the intermediate cleanup yourself. That's sort-of the opposite
of the Reader interface, where you have to care about what you read or
skip. iterparse() even gives you a real tree along the road.
> The suggested solution with lxml for this problem seems to be the
> SAX-like events with a target parse on lxml.etree.
> The SAX interface could eventually be of use for my application but it
> would need many workarounds where as the XmlTextReader interface would
> naturally fit in.
You should definitely try iterparse() before you go for a plain SAX solution.
Stefan
More information about the lxml-dev
mailing list