How to Add Prefix in XML in Python



I have an xml like this



<eo-gateway>
<interface-code>AAA</interface-code>
<supplier-code>XXX</supplier-code>
<authors>
<author type="first">
<forename>John</forename>
<surname>Smith</surname>
</author>
</authors>
</eo-gateway>


I need to arrive to this kind of xml adding prefix "art" in each tag.



<art:eo-gateway>
<art:interface-code>AAA</art:interface-code>
<art:supplier-code>XXX</art:supplier-code>
<art:authors>
<art:author type="first">
<art:forename>John</art:forename>
<art:surname>Smith</art:surname>
</art:author>
</art:authors>
</art:eo-gateway>


Thanks for you help.


No comments:

Post a Comment