On 28 Feb, 19:20, Stefan Behnel <stefan...@behnel.de> wrote: > Hai Vu, 28.02.2010 17:41: > > > By the way, Stefan, I am using Python 2.6. Do you know the differences > > between ElementTree and cElementTree? > > Use cElementTree, it's implemented in C and a lot faster and more memory > friendly. > > http://effbot.org/zone/celementtree.htm#benchmarkshttp://codespeak.net/lxml/performance.html > > Stefan
Thanks for the responses so far, most enlightening. Stefan, I was happy to see such concise code. Your python worked with only very minor modifications. Hai's test xml data *without* the first and last line is close enough to the data I am using: <order customer="john" product="eggs" quantity="12" /> <order customer="cindy" product="bread" quantity="1" /> <order customer="larry" product="tea bags" quantity="100" /> <order customer="john" product="butter" quantity="1" /> <order product="chicken" quantity="2" customer="derek" /> ... quirky. I get a large file given to me in this format. I believe it is created by something like: grep 'customer=' *.xml, where there are a large number of xml files. I had to edit the data to include the first and last lines, <orders> and </orders>, to get the python code to work. It's not an arduous task(!), but can you recommend a way to get it to work without manually editing the data? One other thing, what's the Roland Mueller post above about (I'm viewing htis in google groups)? What would the test.xsl file look like? Thanks again Hal. -- http://mail.python.org/mailman/listinfo/python-list