XML DOM, but in chunks

S

Sean Davis

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
 
M

Marc 'BlackJack' Rintsch

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?

Have you tried `iterparse()`?

Ciao,
Marc 'BlackJack' Rintsch
 
T

Tommy Nordgren

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

--
http://mail.python.org/mailman/listinfo/python-list
You need a Python (or other language) implementation of the SAX API
 
S

Stefan Behnel

Tommy said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top