XML parsing per record
Fredrik Lundh
fredrik at pythonware.com
Sat Apr 16 13:00:27 EDT 2005
Kent Johnson wrote:
>> So I would like to parse a XML file one record at a time and then be able
>> to store the information in another object.
>
> You might be interested in this recipe using ElementTree:
> http://online.effbot.org/2004_12_01_archive.htm#element-generator
if you have ElementTree 1.2.5 or later, the "iterparse" function provides a
more efficient implementation of that pattern:
http://effbot.org/zone/element-iterparse.htm
the cElementTree implemention of "iterparse" is a lot faster than SAX; see
the second table under
http://effbot.org/zone/celementtree.htm#benchmarks
for some figures.
</F>
More information about the Python-list
mailing list