Possible Duplicate:
python: xml.etree.ElementTree, removing “namespaces”
I have a sample xml document
<?xml version="1.0" encoding="UTF-8"?>
<school xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.school.org">
<name>John</name>
<name>Ferus</name>
<name>Greg</name>
</school>
And I have the below python code to find names,
import xml.etree.ElementTree as ElementTree
with open('sample.xml', 'rt') as f:
tree = ElementTree.parse(f)
root = tree.getroot()
for name in root.findall("{http://www.school.org}name"):
print name.text
Providing the namespace each time I search for a tag is clumsy. Is there a better way?