I suggest ElementTree. There are other compatible implementations of the same API, such as lxml, 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.

First build an Element instance root from the XML, e.g. with the XML function, or by parsing a file with something like:

import xml.etree.ElementTree as ET
root = ET.parse('thefile.xml').getroot()

Or any of the many other ways shown at ElementTree. Then do something like:

for type_tag in root.findall('bar/type'):
    value = type_tag.get('foobar')
    print(value)

Output:

1
2
Answer from Alex Martelli on Stack Overflow
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ xml.etree.elementtree.html
xml.etree.ElementTree โ€” The ElementTree XML API
January 29, 2026 - The supported events are the strings ... information). If events is omitted, only "end" events are reported. parser is an optional parser instance....
๐ŸŒ
Real Python
realpython.com โ€บ python-xml-parser
A Roadmap to XML Parsers in Python โ€“ Real Python
September 25, 2023 - In this tutorial, you'll learn what XML parsers are available in Python and how to pick the right parsing model for your specific use case. You'll explore Python's built-in parsers as well as major third-party libraries.
Discussions

python - How can I parse XML and get instances of a particular node attribute? - Stack Overflow
Python has an interface to the expat XML parser. More on stackoverflow.com
๐ŸŒ stackoverflow.com
XML parsing using Python ElementTree to extract specific data - Stack Overflow
I have an xml file that I need to parse. I vaguely understand python and xml. I'm using ElementTree to parse the document, however just about every reference I've researched online gets me on the r... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to process / parse XML with Python
Best bet: Use lxml . There's a nice tutorial on the site, too . You can also use the built-in XML parser, either with ElementTree (common) or XML DOM (rarer) , or any other related library from the xml module , but most people prefer lxml, as it's much more powerful (and in parts, compatible with ElementTree). More on reddit.com
๐ŸŒ r/learnpython
5
11
October 22, 2017
Python 101 โ€“ Intro to XML Parsing with ElementTree

bad link for me :(

More on reddit.com
๐ŸŒ r/Python
12
57
May 1, 2013
๐ŸŒ
Proxidize
proxidize.com โ€บ home โ€บ blog โ€บ how to parse xml in python
How to Parse XML in Python - Proxidize
October 23, 2025 - There are internal and external libraries that can help parse XML in Python. The three internal libraries are ElementTree, MiniDOM, and SAX Parser while the external libraries are BeautifulSoup, Lmxl, and Untangle.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ xml-parsing-python
XML parsing in Python - GeeksforGeeks
June 28, 2022 - Our goal is to process this RSS feed (or XML file) and save it in some other format for future use. Python Module used: This article will focus on using inbuilt xml module in python for parsing XML and the main focus will be on the ElementTree XML API of this module.
๐ŸŒ
EDUCBA
educba.com โ€บ home โ€บ software development โ€บ software development tutorials โ€บ xml tutorial โ€บ xml parsing in python
xml parsing in python | Complete Guide on XML parsing in python
April 18, 2023 - XML means Extensible Markup Language and the main use of XML is for the web page. Basically, python allows us to parse the XML document by using two different modules that we called as xml.etree and Element Tree module.
Call ย  +917738666252
Address ย  Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Find elsewhere
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ xml.html
XML Processing Modules โ€” Python 3.14.3 documentation
The built-in XML parsers of Python rely on the library libexpat, commonly called Expat, for parsing XML.
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ python-xml-elementtree
Python XML Tutorial: Element Tree Parse & Read | DataCamp
December 10, 2024 - Parse and read XML data with Element Tree Python package. Learn how to use xml.etree.elementtree and explore your data through XML today!
๐ŸŒ
Decodo
decodo.com โ€บ blog โ€บ parse-xml-python
Learn How to Parse XML in Python
However, the two most widely used XML parsers in the Python ecosystem are ElementTree (xml.etree.ElementTree) and lxml.
๐ŸŒ
Royal Network
ftp.kerusso.com โ€บ home โ€บ news โ€บ xml parsing in python: a guide to `xml.etree.elementtree`
XML Parsing In Python: A Guide To `xml.etree.ElementTree`
January 6, 2026 - Hey guys! Ever need to wrangle some XML data in your Python projects? Well, youโ€™re in luck! Pythonโ€™s got your back with a super handy library called xml.etree.ElementTree. Itโ€™s like your Swiss Army knife for dealing with XML: parsing, navigating, and even modifying those XML files.
๐ŸŒ
Close
making.close.com โ€บ posts โ€บ state-of-xml-parsing-in-python
State of XML Parsing in Python | The Making of Close
Outside of Pythonโ€™s ecosystem, a good example that crosses many of those items would be Nokogiri: Nokogiri (้‹ธ) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is fast and standards-compliant by relying on native parsers like libxml2, libgumbo, and xerces.
๐ŸŒ
Roy Tutorials
roytuts.com โ€บ home โ€บ python โ€บ parsing xml using python
Parsing XML using Python - Roy Tutorials
November 22, 2023 - So basically parsing XML using Python means reading the XML node data and further doing something with those data to use in this application.
๐ŸŒ
Bright Data
brightdata.com โ€บ blog โ€บ how-tos โ€บ parsing-xml-in-python
How to Parse XML in Python? Multiple Methods Covered
September 16, 2025 - untangle is a lightweight XML parsing library for Python that simplifies the process of extracting data from XML documents. Unlike traditional XML parsers that require navigating through hierarchical structures, untangle lets you access XML ...
๐ŸŒ
lxml
lxml.de
lxml - Processing XML and HTML with Python
lxml - the most feature-rich and easy-to-use library for processing XML and HTML in the Python language
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 77602510 โ€บ xml-parsing-using-python-elementtree-to-extract-specific-data
XML parsing using Python ElementTree to extract specific data - Stack Overflow
Every reference ive read including the python documentation leads me to pulling all attributes with status Open, but this causes me to pull category2 and category3's which I dont want. Is there any way to isolate this to just category1 children? I want to eventually append the output to a list but can figure that out once I isolate this output. ... import xml.etree.ElementTree as ET report = xmldocument.xml tree = ET.parse(report) root = tree.getroot() cat1findings = [] for item in root.iter('category1'): for blah in root.iter(blah): if blah.attrib == 'Status="Open"': cat1findings.append(output)
๐ŸŒ
Girish Godage
girishgodage.in โ€บ blog โ€บ pythonXMLParser
Python XML Parser โ€“ Girish Godage
October 2, 2019 - Python XML Parser Tutorial - Read xml file example(Minidom, ElementTree)
๐ŸŒ
lxml
lxml.de โ€บ parsing.html
Parsing XML and HTML with lxml
lxml.etree has broader support for Python unicode strings than the ElementTree library. First of all, where ElementTree would raise an exception, the parsers in lxml.etree can handle unicode strings straight away. This is most helpful for XML snippets embedded in source code using the XML() function:
๐ŸŒ
Zyte
zyte.com โ€บ learn โ€บ a-practical-guide-to-xml-parsing-with-python
A Practical Guide to Python XML Parsing
In this guide, weโ€™ll dive into the world of XML parsing using ยท Python, providing not just basic methods but also advanced techniques like handling XML namespaces, performing XPath queries, and mapping XML data to custom Python objects.