Use ElementTree:

import xml.etree.ElementTree as ET
tree = ET.parse('Config.xml')
root = tree.getroot()
print(root.findall('.//Log'))

Output:

pawel@pawel-XPS-15-9570:~/test$ python parse_xml.py 
[<Element 'Log' at 0x7fb3f2eee9f
Answer from pawelbylina on Stack Overflow
🌐
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!
🌐
Python
docs.python.org › 3 › library › xml.etree.elementtree.html
xml.etree.ElementTree — The ElementTree XML API
January 29, 2026 - For the XML data ... the a element ... tail "3". To collect the inner text of an element, see itertext(), for example "".join(element.itertext())....
Discussions

How to read xml file using python? - Stack Overflow
Unless you have a very specific need to work with the very minimal and basic W3C DOM API, you want to be using the xml.etree.ElementTree API instead. The DOM API is aimed as a minimal common ground between lots of programming languages, many not nearly as expressive as Python. More on stackoverflow.com
🌐 stackoverflow.com
XML parsing using Python ElementTree to extract specific data - Stack Overflow
better create minimal working code with correct example data so we could simply copy and run it - to see problem and test solutions. ... I would use lxml and xpath to find it. Because xml is not complete so I use lxml.html instead of lxml.etree. It may have one problem. I uses C/C++ libraries libxml2 and libxslt which you have to install separately (because it is not Python ... More on stackoverflow.com
🌐 stackoverflow.com
How would I parse XML that I get through Pycurl?

Parsing any html or xml is easiest with BeautifulSoup. Just remember to specify that's it's XML, or it will default to HTML:

soup = bs4.BeautifulSoup(body, 'xml')
More on reddit.com
🌐 r/learnpython
4
0
November 11, 2011
Which one is the better python xml parsing tool. ElementTree vs lxml

they have different behaviour, as can be seen in this comparison

TLDR; lxml is faster, has more features (full xpath support, xslt)

More on reddit.com
🌐 r/learnpython
4
3
September 15, 2014
🌐
OneUptime
oneuptime.com › home › blog › how to work with xml files in python
How to Work with XML Files in Python
January 25, 2026 - Learn how to read, write, parse, and manipulate XML files in Python using the built-in ElementTree module and the powerful lxml library. This guide covers practical examples for common XML operations.
Find elsewhere
🌐
Zyte
zyte.com › learn › a-practical-guide-to-xml-parsing-with-python
A Practical Guide to Python XML Parsing
Python provides convenient methods to change the content, attributes, and structure of an XML tree. You can modify the text content of any element in the XML tree: ... This snippet updates the text of all child elements to 'Updated Value'. Just like element text, attributes can also be modified dynamically: ... This example changes the id attribute of every <child> element to '2'.
🌐
Real Python
realpython.com › python-xml-parser
A Roadmap to XML Parsers in Python – Real Python
September 25, 2023 - It’s somewhat limited compared to the DOM but should be enough to implement a basic XML streaming push parser without resorting to third-party libraries. With this in mind, there’s a less verbose pull parser available in Python, which you’ll explore next. ... The parsers in the Python standard library often work together. For example, the xml.dom.pulldom module wraps the parser from xml.sax to take advantage of buffering and read the document in chunks.
🌐
Python Module of the Week
pymotw.com › 2 › xml › etree › ElementTree › create.html
Creating XML Documents - Python Module of the Week
The output contains only the XML nodes in the tree, not the XML declaration with version and encoding. $ python ElementTree_create.py <top><!--Generated for PyMOTW--><child>This child contains text.</ch ild><child_with_tail>This child has regular text.</child_with_tail>A nd "tail" text.<child_with_entity_ref>This &amp; that</child_with_en tity_ref></top>
🌐
W3Schools
w3schools.com › xml
XML Tutorial
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
🌐
Tutorialspoint
tutorialspoint.com › home › python › python xml processing
Python XML Processing
February 21, 2009 - Discover how to effectively process XML data in Python with practical examples and libraries.
🌐
Python 101
python101.pythonlibrary.org › chapter31_lxml.html
Chapter 31 - Parsing XML with lxml — Python 101 1.0 documentation
In Part I, we looked at some of Python’s built-in XML parsers. In this chapter, we will look at the fun third-party package, lxml from codespeak. It uses the ElementTree API, among other things. The lxml package has XPath and XSLT support, includes an API for SAX and a C-level API for compatibility with C/Pyrex modules. Here is what we will cover: ... For this chapter, we will use the examples from the minidom parsing example and see how to parse those with lxml.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-parse-xml-in-python-without-using-external-libraries
How to Parse XML in Python Without Using External Libraries
November 12, 2025 - We'll parse the full product catalog and convert it to a Python list of dictionaries. def parse_product_catalog(xml_file): """Parse an XML product catalog and return a list of product dictionaries.""" tree = ET.parse(xml_file) root = ...
🌐
Diveintopython3
diveintopython3.net › xml.html
XML - Dive Into Python 3
An element’s attributes form ... like a Python dictionary. There is no limit to the number of attributes you can define on each element. Elements can have text content. ... Elements that contain no text and no children are empty. ... There is a shorthand for writing empty elements. By putting a / character in the start tag, you can skip the end tag altogther. The XML document in the previous example could be written ...
🌐
Medium
medium.com › data-science › processing-xml-in-python-elementtree-c8992941efd2
Processing XML in Python — ElementTree | by Deepesh Nair | TDS Archive | Medium
September 18, 2018 - Processing XML in Python — ElementTree A Beginner’s Guide Learn how you can parse, explore, modify and populate XML files with the Python ElementTree package, for loops and XPath expressions. As …
🌐
ScrapingDog
scrapingdog.com › blog › xml-parsing-python
How To Parse XML in Python (Detailed Guide)
May 7, 2025 - Demonstrates different Python libraries for XML parsing (e.g., ElementTree, lxml). Provides example code to extract specific elements and attributes from XML.
🌐
Towards Data Science
towardsdatascience.com › home › latest › parsing xml data in python
Parsing XML Data in Python | Towards Data Science
January 19, 2025 - For our purposes we will be using a sample ‘xml’ file, ‘books.xml’ ,which can be found here. The file contains information about a variety of books, such as titles, author names, and prices. To start, let’s import ‘parse’ from the ‘ElementTree’ module in the python ‘xml’ library:
🌐
Edureka
edureka.co › blog › python-xml-parser-tutorial
Python XML Parser Tutorial | ElementTree and Minidom Parsing | Edureka
December 5, 2024 - EXAMPLE: ... OUTPUT: Idly Paper Dosa Upma Bisi Bele Bath Kesari Bath To calculate the number of items on our menu, you can make use of the len() function as follows: ... The output specifies that our menu consists of 5 items. This brings us to the end of this Python XML Parser Tutorial.
🌐
Python Forum
python-forum.io › thread-9489.html
Parse XML with Namespaces
Hello All - I am trying to parse some xml files that are saturated with Namespaces. I have been able to parse XML files without namespaces. I have found several articles online on parsing with Namespa
🌐
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)