python - How could I infuse elements with other elements in an xml using Minidom? -
i'm using minidom python 3.5
the original xml data looks this: (# of beat , editdata_score node/tags fixed (in case 3 each).
<editdata_score> <editdatatype>beat_score</editdatatype> <spot>20</spot> <time>7</time> <type>x</type> <beat> <editdatatype>beat_mark</editdatatype> <spot>26</spot> <beatlength>4.84472036</beatlength> </beat> </editdata_score> <editdata_score> <editdatatype>beat_score</editdatatype> <spot>36</spot> <time>10</time> <type>x</type> <beat> <editdatatype>beat_mark</editdatatype> <spot>48</spot> <beatlength>4.84472036</beatlength> </beat> </editdata_score>
as can see, beat elements nested in editdata_score elements. , spot node's value increasing. want consolidate editdata_score elements, add minor alterations put , redistribute beats within them such editdata_score encapsulates specified beats:
<editdata_score> <editdatatype>beat_score</editdatatype> <spot>20</spot> <time>17</time> <type>x</type> <beat> <editdatatype>beat_mark</editdatatype> <spot>26</spot> <beatlength>4.84472036</beatlength> </beat> <beat> <editdatatype>beat_mark</editdatatype> <spot>48</spot> <beatlength>4.84472036</beatlength> </beat> </editdata_score>
i figured parse xml once and:
- add beats want group list
- add editdatascores want keep list
parse again and:
- delete/remove/unset? old beats , editdatascores
- barf out beat groups in appropriate editdatascore
Comments
Post a Comment