xml aggregator

kepioo nkammah at yahoo.fr
Sun Jul 9 05:39:46 EDT 2006


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"]

  the tree i want in the end would be :
<results>
<route id="23">
    <equip id=jr2">
        <time id="3pm">
            <data>my first value</data>
            <data>my third value</data>
       </time>
    </equip>
    <equip id=jr1">
        <time id="3pm">
            <data>my second value</data>
       </time>
    </equip>
<route id="24">
    <equip id=jr2">
        <time id="3pm">
            <data>my fourthvalue</data>
       </time>
    </equip>
<route id="25">
    <equip id=jr2">
        <time id="3pm">

            <data>my fifth value</data>
       </time>
    </equip>
</results>


If anyone has an idea of implemetation or any code ( i was trying with
ElementTree...

thank you so much




More information about the Python-list mailing list