XML DOM, but in chunks

Stefan Behnel stefan.behnel-n05pAM at web.de
Thu Nov 1 04:47:23 EDT 2007


Tommy Nordgren wrote:
>> On 31 okt 2007, at 21.24, Sean Davis wrote:
>>
>>> I have some very large XML files that are basically recordsets.  I
>>> would like to access each record, one-at-a-time, and I particularly
>>> like the ElementTree library for accessing the data.  Is there a way
>>> to have ElementTree read only one record of the data at a time?
>>> Alternatively, are there other ways that would allow one to parse out
>>> a record at a time and maintain some nice ways of accessing the
>>> elements within the record?
>>>
>>> Thanks,
>>> Sean
>>>
>>     You need a Python (or other language) implementation of the SAX API
>>     
>     The module you need is xml.sax

That's unlikely - few people "need" SAX. If they think they do, they just
don't know the alternatives. I think iterparse() is what he was looking for.

Stefan



More information about the Python-list mailing list