I have to delete particular tags from an xml file. Sample xml below.
<data:abc><data>
<tag:action tag:language="name"/>
</data:abc>data>
I want to delete all contents between "data:abc"data and </data:abc>. The XML tags are not displayed in the question after posting.
I am able to do this by using remove() method in Python ElementTree xml parser. I am writing the modified contents to a new after the deletion of the element.
tree.write('new.xml');
The problem is that all the tag names in the original xml file are renamed to ns0, ns1 and so on in new.xml.
Is there any way to modify the XML file keeping all other contents in tact?