The XML:
<tree>
<row>
<a>This is a</a>
<b>This is b</b>
</row>
</tree>
So I have seen many solutions across the web and looked up many of them already. The following didn't work for me:
tree = etree.XML('file.xml')
print tree[0].findtext('a'). // None
print tree[0].find('a'). // None
print tree[0].xpath('a') // None
print tree[0].xpath('/a') //None
print tree[0].xpath('//a') //None
print tree[0].xpath('/a') //None
print tree.xpath('//row/a') //None
print tree.xpath('//row/a/text()') //None
The only way i found is like doing tree[0][0].text
But my actual XML contains 25 subelements and it isn't really clean code to do this 25 times..
Maybe you guys know what i am doing wrong?
I also know there is something like BeautifulSoup but after testing, i came to the conclusion this does not fit my case due to the performance.. (benchmark here)
Thanks!