From the below XML, I want to remove the start and end tag for <root>
so that <INVOKE>
becomes the top level node.
Also the <item>
tag is to be removed in such a way that <DNAME>
,<PEMAIL>
and <PHONE>
becomes the child of <PER>
I found the solution for deleting the child nodes from https://docs.python.org/3/library/xml.etree.elementtree.html. But the child node has to be deleted in such a way that the grand-child becomes the child node.
<root>
<Invoke>
<Set>
<INT>
<co>1</co>
<ti>2</ti>
<WOSTATUS>11</WSTATUS>
<PER>
<item>
<DNAME>12</DNAME>
<PEMAIL>13</PEMAIL>
<PPHONE>14</PPHONE>
</item>
</PER>
</INT>
</Set>
</Invoke>
</root>