Re: Iterparse and ElementTree confusion

2005-08-18 Thread paul . sherwood
Ofcourse! Thankyou so much. All is well, using the Iterparse takes a mere 3mins to find the last product in the xml and this is probably due to my checking 1 products for a specific. I feel rather honoured to have 'the' effbot reply to my humble post Thanks again Paul -- http://mail.p

Re: Iterparse and ElementTree confusion

2005-08-17 Thread Steve M
"when i attempted [to load 150MB xml file] my PC goes to lala land, theres much HDD grinding followed by "windows runnign low on virtual memory" popup after 10-15mins. Then just more grinding...for an hour before i gave up" I have had great success using SAX to parse large XML files. If you use ca

Re: Iterparse and ElementTree confusion

2005-08-17 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > def parse_for_products(filename): > >for event, elem in iterparse(filename): >if elem.tag == "Products": >root = ElementTree(elem) >print_all(root) >else: >elem.clear() > > My problem is that if i pass the 'elem' fo

Re: Iterparse and ElementTree confusion

2005-08-17 Thread paul . sherwood
Further to the above I pass my found element 'Product' to ElementTree's handy print all function def print_all(element): root = element #Create an iterator iter = root.getiterator() #Iterate for element in iter: #First the element tag name print "Element:",