Gerard Flanagan wrote: > kepioo wrote: > > Hi all, > > > > I am trying to write an xml aggregator, but so far, i've been failing > > miserably. > > > > what i want to do : > > > > i have entries, in a list format :[[key1,value],[key2,value],[ > > key3,value]], value] > > > > example : > > [["route","23"],["equip","jr2"],["time","3pm"]],"my first value"] > > [["route","23"],["equip","jr1"],["time","3pm"]],"my second value"] > > [["route","23"],["equip","jr2"],["time","3pm"]],"my third value"] > > [["route","24"],["equip","jr2"],["time","3pm"]],"my fourth value"] > > [["route","25"],["equip","jr2"],["time","3pm"]],'"my fifth value"] > > > > [snip example data] > > > > > > > If anyone has an idea of implemetation or any code ( i was trying with > > ElementTree... > > > > (You should have posted the code you tried) > > The code below might help (though you should test it more than I have). > The 'findall' function comes from here: > > http://gflanagan.net/site/python/elementfilter/elementfilter.py > > it's not the elementtree one. >
Sorry, elementfilter.py was a bit broken - fixed now. Use the current one and change the code I posted to: [...] existing_route = findall(results, "[EMAIL PROTECTED]" % routeid) #changed line if existing_route: route = existing_route[0] existing_equip = findall(route, "[EMAIL PROTECTED]'%s']" % equipid) if existing_equip: [...] ie. don't quote the route id since it's numeric. Gerard -- http://mail.python.org/mailman/listinfo/python-list