I'm trying to parse XML to table-like structure in Python. Imagine XML like this:
<?xml version="1.0" encoding="UTF-8"?>
<base>
<element1>element 1</element1>
<element2>element 2</element2>
<element3>
<subElement3>subElement 3</subElement3>
</element3>
</base>
I'd like to have result like this:
KEY | VALUE
base.element1 | "element 1"
base.element2 | "element 2"
base.element3.subElement3 | "subElement 3"
I've tried using xml.etree.cElementTree, then functions described here How to convert an xml string to a dictionary in Python?
Is there any function that can do this? All answers I found are written for particular XML schemes and would need to be edited for each new XML scheme. For reference, in R it's easy with XML and XML2 packages and xmlToList function.