Re: Python parsing XML file problem with SAX

2010-08-24 Thread Aahz
In article , Stefan Behnel wrote: >Christian Heimes, 10.08.2010 01:39: >> Am 10.08.2010 01:20, schrieb Aahz: >>> The docs say, "Parses an XML section into an element tree incrementally". >>> Sure sounds like it retains the entire parsed tree in RAM. Not good. >>> Again, how do you parse an XML f

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Stefan Behnel
Christian Heimes, 10.08.2010 01:39: Am 10.08.2010 01:20, schrieb Aahz: The docs say, "Parses an XML section into an element tree incrementally". Sure sounds like it retains the entire parsed tree in RAM. Not good. Again, how do you parse an XML file larger than your available memory using somet

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Christian Heimes
Am 10.08.2010 01:20, schrieb Aahz: > The docs say, "Parses an XML section into an element tree incrementally". > Sure sounds like it retains the entire parsed tree in RAM. Not good. > Again, how do you parse an XML file larger than your available memory > using something other than SAX? The docum

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Aahz
In article , Stefan Behnel wrote: >Aahz, 09.08.2010 18:52: >> In article, >> Stefan Behnel wrote: >>> >>> First of all: don't use SAX. Use ElementTree's iterparse() function. That >>> will shrink you code down to a simple loop in a few lines. >> >> Unless I'm missing something, that only helps if

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Stefan Behnel
Aahz, 09.08.2010 18:52: In article, Stefan Behnel wrote: First of all: don't use SAX. Use ElementTree's iterparse() function. That will shrink you code down to a simple loop in a few lines. Unless I'm missing something, that only helps if the final tree fits into memory. What do you suggest

Re: Python parsing XML file problem with SAX

2010-08-09 Thread Aahz
In article , Stefan Behnel wrote: > >First of all: don't use SAX. Use ElementTree's iterparse() function. That >will shrink you code down to a simple loop in a few lines. Unless I'm missing something, that only helps if the final tree fits into memory. What do you suggest other than SAX if you

Re: Python parsing XML file problem with SAX

2010-07-28 Thread Stefan Behnel
jia li, 28.07.2010 12:10: I have an XML file with hundreds of elements. What's strange is only one of there elements could not be parsed correctly: REVERSE_INULL Dispose_ParameterList Dispose_ParameterList UNINSPECTED 146 1/146MMSLib_LinkedList.c I printed the data in "characters(self, data)

Python parsing XML file problem with SAX

2010-07-28 Thread jia li
I have an XML file with hundreds of elements. What's strange is only one of there elements could not be parsed correctly: REVERSE_INULL Dispose_ParameterList Dispose_ParameterList UNINSPECTED 146 1/146MMSLib_LinkedList.c I printed the data in "characters(self, data)" and after parsing. The res