NEWB: reverse traversal of xml file
manstey
manstey at csu.edu.au
Mon May 22 20:41:38 EDT 2006
Hi,
I have an xml file of about 140Mb like this:
<book>
<record>
...
<wordpartWTS>1</wordpartWTS>
</record>
<record>
...
<wordpartWTS>2</wordpartWTS>
</record>
<record>
...
<wordpartWTS>1</wordpartWTS>
</record>
</book>
I want to traverse it from bottom to top and add another field to each
record <totalWordPart>1</totalWordPart>
which would give the highest value of wordpartWTS for each record for
each word
so if wordparts for the first ten records were 1 2 1 1 1 2 3 4 1 2
I want totalWordPart to be 2 2 1 1 4 4 4 4 2 2
I figure the easiest way to do this is to go thru the file backwards.
Any ideas how to do this with an xml data file?
Thanks
More information about the Python-list
mailing list