I have XML file and I want to parse only tags, but I need to preserve hierarchy and order of that tags. I use xml.etree.ElementTree to do that but I extract the only list of tags.
My XML looks like:
<Collection variable="value">
<Genre variable="value">
<Timestamp>2017-05-15T18:14:07-05:00</Timestamp>
<Date>2016-12-31</Date>
<Identifier>
<id>123456789</id>
<Name>
<BusinessName>AB & co</BusinessName>
</Name>
</Identifier>
</Genre>
</Collection>
and desired output should be list of tags with their parent tags
['Collection/Genre',
'Collection/Genre/Timestamp',
'Collection/Genre/Date',
'Collection/Genre/Identifier/id',
'Collection/Genre/Identifier/Name/BusinessName']
any help would be appreciate.
getpath()method. See stackoverflow.com/a/1577495/407651.