I'm using lxml and I have a xml like this:
<UploadFile>
<Eu>
<AUTO_ID>4</AUTO_ID>
<Meter>000413031</Meter>
</Eu>
</UploadFile>
How can I only get the tag that has text like AUTO_ID and Meter,but not UploadFile Eu?
I have tried:
tree = lxml.etree.parse(xmlfile)
root = tree.getroot()
for node in root.iter('*'):
if node.text != None:
print(node.tag,node.text)
But still I can get all the tags,I only want the tag has text with it,what can I do ?Any friend can help?Best regards!