I have an xml file like:
<Table1>
<ID>1</ID>
<Name>ABC1</Name>
</Table1>
<Table1>
<ID>2</ID>
<Name>ABC2</Name>
</Table1>
<Table2>
<NEWID>1</NEWID>
<phone>123</phone>
</Table2>
<Table2>
<NEWID>2</NEWID>
<phone>12334</phone>
</Table2>
<Table3>
<SNO>1</SNO>
<data>XYZ</data>
</Table3>
<Table3>
<SNO>2</SNO>
<data>SDF</data>
</Table3>
I want a new xml file to contain only first data corresponding to each table. i.e. New file should be something like:
<Table1>
<ID>1</ID>
<Name>ABC1</Name>
</Table1>
<Table2>
<NEWID>1</NEWID>
<phone>123</phone>
</Table2>
<Table3>
<SNO>1</SNO>
<data>XYZ</data>
</Table3>
Actually the file I am working on has hundreds of such tables with a million rows so it is not possible to make new xml manually. Please help if I can do such thing in python or any other way