I suggest [`ElementTree`][1]. There are other compatible implementations of the same API, such as [`lxml`][2], and `cElementTree` in the Python standard library itself; but, in this context, what they chiefly add is even more speed -- the ease of programming part depends on the API, which `ElementTree` defines.
After building an Element instance `e` from the XML, e.g. with the [XML][3] function, or by parsing a file with something like
import xml.etree.ElementTree
e = xml.etree.ElementTree.parse('thefile.xml').getroot()
or any of the many other ways shown at [`ElementTree`][1], you just do something like:
for atype in e.findall('type'):
print(atype.get('foobar'))
and similar, usually pretty simple, code patterns.
---
Should you require more performance, then you can use the C implementation of this API, but it usually requires a c-compiler during the installation.
import xml.etree.cElementTree
e = xml.etree.cElementTree.parse('thefile.xml').getroot()
[1]: http://docs.python.org/library/xml.etree.elementtree.html
[2]: http://lxml.de/
[3]: http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.XML