472,983 Members | 2,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,983 software developers and data experts.

XML DOM, but in chunks

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

Oct 31 '07 #1
5 1162
On Wed, 31 Oct 2007 20:24:43 +0000, 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?
Have you tried `iterparse()`?

Ciao,
Marc 'BlackJack' Rintsch
Oct 31 '07 #2

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

--
http://mail.python.org/mailman/listinfo/python-list
You need a Python (or other language) implementation of the SAX API
----------------------------------
Skinheads are so tired of immigration, that they are going to move to
a country that don't accept immigrants!
Tommy Nordgren
to************@comhem.se

Oct 31 '07 #3

On 31 okt 2007, at 22.36, 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

--
http://mail.python.org/mailman/listinfo/python-list
You need a Python (or other language) implementation of the SAX API
The module you need is xml.sax
----------------------------------
Skinheads are so tired of immigration, that they are going to move to
a country that don't accept immigrants!
Tommy Nordgren
to************@comhem.se

Nov 1 '07 #4
On Oct 31, 4:43 pm, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
On Wed, 31 Oct 2007 20:24:43 +0000, 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?

Have you tried `iterparse()`?

Ciao,
Marc 'BlackJack' Rintsch
Detailed docs at http://effbot.org/zone/element-iterparse.htm

George

Nov 1 '07 #5
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
Nov 1 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Don | last post by:
Hi all, I need to read an uploaded file into chunks, so I can examine the acculative size between chunks to determine if a maximum size is being exceeded. I'm currently using the PHP function...
1
by: Guy Erez | last post by:
Hi, I'm running queries with MySql 4.0.17 that return thousands of records. Because I need to present them in GUI, I returieve the results in chunks using LIMIT, for example - get first 100,...
0
by: I Decker | last post by:
Hi all, Quite often I drag chunks of code onto the toolbox, so that I can reuse them later (even in different projects).I tend to drag them into a seperate tab that I created called code bits. I...
1
by: Nawaz Ijaz | last post by:
Hi All, Just need to know that how can it be possible to upload large file in chunks of bytes. Suppose i have a large file (100 MB) and i want to upload it in chunks (say 20 KB). How can this be...
1
by: Johan | last post by:
Here is my problem and I hope there is someone out-there who can help me. I want to search my domain for all users and groups. And since there are lot of them I want to read them back in chunks...
6
by: MackS | last post by:
Hello everyone I am faced with the following problem. For the first time I've asked myself "might this actually be easier to code in C rather than in python?", and I am not looking at device...
1
by: Al | last post by:
Searching for a way to upload binary files from client to server, I came across the following link: http://www.dotnetextreme.com/code/BinaryUpload.asp With this precaution: Editor's note -...
1
by: mdefoor | last post by:
I've written the following sample to split a string into chunks. Is this the right approach or is there perhaps a better way to accomplish getting chunks of a string? #include <stdio.h>...
1
by: JayDog | last post by:
I have a large data file that I split into smaller more manageable chunks (went from a 12.86 GB file to 500 MB - 1.6 GB chunks). I now want to add to the PERL script and go back through those more...
3
by: codemannh | last post by:
I have been trying to figure out the best way to parse some chunks of html code that contain tables. I've been trying to do this with HTML::Parser and HTML::TokeParser and HTML::TokeParser::Simple,...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.