I'm a bit new to Python and to the XML world. I desperately need your help, I'm running out of time to finish this project! Basically I have a xml file that I need to elaborate before importing it into Excel. My XML is structured as follows (very small extract):
<?xml version="1.0" encoding="UTF-8"?>
<Application>
<first/>
<second>
<third/>
<third/>
<third/>
</second>
</Application>
What I need to do is to parse the xml file (elementtree or lxml) and to eliminate <first/>
and <second/>
, in order to get something like this:
<?xml version="1.0" encoding="UTF-8"?>
<Application>
<third/>
<third/>
<third/>
</Application>
I have already read and tried basically all the related questions I could find, but all I managed to achieve was to eliminate the whole <first/>
element.
I'm using Python 3.6.2, standard libraries are preferred (lxml, elementtree).
Thanks in advance for any help you can give!