None of the above fixes worked for me. The only thing that worked was to use BeautifulSoup
instead of ElementTree
as follows:
from bs4 import BeautifulSoup
with open("data/myfile.xml") as fp:
soup = BeautifulSoup(fp, 'xml')
Then you can search the tree as:
soup.find_all('mytag')