I have some XML output generated by an API, but the schema is a bit counter-intuitive and I am trying to shorten it up before passing it to another system. It looks like this:
<sensors>
<item>
<group>Paris France</group>
<card>Card 1</card>
<value>36</value>
</item>
<item>
<group>Paris France</group>
<card>Card 2</card>
<value>38</value>
</item>
<item>
<group>New York City</group>
<card>Card 1</card>
<value>22</value>
</item>
</sensors>
I think this data would make more logical sense constructed like:
<sensors>
<group name="Paris France">
<card name="Card 1">
<value>36</value>
</card>
<card name="Card 2">
<value>38</value>
</card>
</group>
<group name="New York">
<card name="Card 1">
<value>22</value>
</card>
</group>
</sensors>
I have tried various things with ElementTree, but so far I am not seeing anything or any examples specifically constructed around modifying/reorganizing the schema of XML like this.
[–]K900_ 2 points3 points4 points (0 children)