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
🌐
Python
docs.python.org › 3 › library › xml.etree.elementtree.html
xml.etree.ElementTree — The ElementTree XML API
January 29, 2026 - If not given, the standard XMLParser parser is used. parser must be a subclass of XMLParser and can only use the default TreeBuilder as a target. Returns an iterator providing (event, elem) pairs; it has a root attribute that references the root element of the resulting XML tree once source is fully read. The iterator has the close() method that closes the internal file object if source is a filename.
🌐
GeeksforGeeks
geeksforgeeks.org › python › reading-and-writing-xml-files-in-python
Reading and Writing XML Files in Python - GeeksforGeeks
January 12, 2026 - To modify an XML file, you first parse it, then change attributes or content, and finally save or print it. ... from bs4 import BeautifulSoup with open('dict.xml', 'r') as f: data = f.read() bs_data = BeautifulSoup(data, 'xml') for tag in bs_data.find_all('child', {'name':'Frank'}): tag['test'] = "WHAT !!" print(bs_data.prettify()) ... ElementTree is included in Python’s standard library, so no installation is required.
Discussions

Accessing online xml with python - Stack Overflow
I am trying to access an xml file (many actually) from an online source. I had a code that would do it but i installed a fresh OS and forgot to back up my phython scripts :( I am literally just tr... More on stackoverflow.com
🌐 stackoverflow.com
Extract information from an xml file
I have an xml file looks like this #root element #child elements #the sub-child elements I want to get name 25 ASN #Lots of elements after this 26 ALA #... More on discuss.python.org
🌐 discuss.python.org
0
0
June 12, 2023
python - read xml files online - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
How to parse a XML file into a kotlin Data Class
🌐 r/Kotlin
14
17
March 3, 2019
🌐
LearnPython.com
learnpython.com › blog › read-xml-into-python
How to Read XML Files into Python | LearnPython.com
Learn what XML files are used for and how to read XML files into Python using BeautifulSoup and xmltodict.
🌐
DataCamp
datacamp.com › tutorial › python-xml-elementtree
Python XML Tutorial: Element Tree Parse & Read | DataCamp
December 10, 2024 - Learn how you can parse, explore, modify and populate XML files with the Python ElementTree package, for loops and XPath expressions. ... Get your team access to the full DataCamp for business platform. Run and edit the code from this tutorial onlineRun code
🌐
Guru99
guru99.com › home › python › python xml file – how to read, write & parse
Python XML File – How to Read, Write & Parse
August 12, 2024 - Learn how to create,read, and parse XML Files in Python using minidom class and ElementTree. Python XML Tutorial with Example.
Find elsewhere
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › scenarios › xml
XML parsing — The Hitchhiker's Guide to Python
import xmltodict with open('path/to/file.xml') as fd: doc = xmltodict.parse(fd.read()) and then you can access elements, attributes, and values like this: doc['mydocument']['@has'] # == u'an attribute' doc['mydocument']['and']['many'] # == [u'elements', u'more elements'] doc['mydocument']['plus']['@a'] # == u'complex' doc['mydocument']['plus']['#text'] # == u'element as well' xmltodict also lets you roundtrip back to XML with the unparse function, has a streaming mode suitable for handling files that don’t fit in memory, and supports XML namespaces.
🌐
Edureka
edureka.co › blog › python-xml-parser-tutorial
Python XML Parser Tutorial | ElementTree and Minidom Parsing | Edureka
December 5, 2024 - In this Python XML Parser Tutorial, you will learn how to parse, read, modify and find elements from XML files in Python using ElementTree and Minidom.
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.read_xml.html
pandas.read_xml — pandas documentation - PyData |
Read XML document into a DataFrame object. ... String path, path object (implementing os.PathLike[str]), or file-like object implementing a read() function. The string can be a path. The string can further be a URL.
🌐
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 - In software development, you’ll run into XML (Extensible Markup Language) when working with configuration files, API responses, data exports, and more. While there are powerful third-party libraries for parsing XML, Python's standard library already ...
🌐
Oxylabs
oxylabs.io › blog › python-parse-xml
How to Parse XML in Python
Now, let’s learn how to parse XML files using these libraries. Fortunately, both `minidom` and `ElementTree` provide a built-in function to parse XML files. You can use the `parse` method of `minidom` to read XML content from a file.
🌐
Dive into Python
diveintopython.org › home › learn python programming › file handling and file operations › xml files handling
XML File Operations with Python - Read, Write and Parse XML Data
May 3, 2024 - The articles describes how you can open and read XML files using Python. Code examples show you how to convert XML data to CSV format as well.
🌐
OneUptime
oneuptime.com › home › blog › how to work with xml files in python
How to Work with XML Files in Python
January 25, 2026 - Python's xml.etree.ElementTree module is included in the standard library and handles most XML tasks well. # xml_reader.py # Reading and parsing XML files with ElementTree import xml.etree.ElementTree as ET def read_xml_file(filepath): """Read and parse an XML file, returning the root element.""" # Parse the XML file and get the tree structure tree = ET.parse(filepath) # Get the root element of the tree root = tree.getroot() return root def extract_book_data(root): """Extract book information from the XML structure.""" books = [] # Find all 'book' elements under the root for book in root.finda
🌐
Python.org
discuss.python.org › python help
Extract information from an xml file - Python Help - Discussions on Python.org
June 12, 2023 - I have an xml file looks like this <report> #root element <bindingsite id="1" has_interactions="True"> <interactions> #child elements <hydrophobic_interactions/> #the sub-child elements I want to get name …
🌐
GitHub
github.com › oxylabs › how-to-parse-xml-in-python
GitHub - oxylabs/how-to-parse-xml-in-python: Follow this in-depth technical tutorial to learn how to parse XML data in Python, what libraries you should use, how to handle invalid XML, and more. · GitHub
Now, let's learn how to parse XML files using these libraries. Fortunately, both minidom and ElementTree provide a built-in function to parse XML files. You can use the parse method of minidom to read XML content from a file.
Author   oxylabs
🌐
Stack Overflow
stackoverflow.com › questions › 29267405 › read-xml-files-online
python - read xml files online - Stack Overflow
response.read() takes an optional argument that is the number of bytes to read from the response; an integer, whole number.
🌐
PythonForBeginners.com
pythonforbeginners.com › home › working with an xml file in python
Working With an XML File in Python - PythonForBeginners.com
February 27, 2023 - Now, we will discuss approaches to read and manipulate XML files using the xmltodict module. You can install this module using pip by executing the following command in your command prompt. ... To create an XML file in python, we can use a python dictionary and the unparse() method defined in the xmltodict module.
🌐
Apify
blog.apify.com › python-parse-xml
How to parse XML in Python
July 16, 2025 - In this guide, you’ll learn in ... files in Python. Here, we’ll focus on the ElementTree API, a built-in, simple, lightweight XML processor for parsing XML. Additionally, we’ll explore extracting and parsing data from XML files using Beautiful Soup and LXML. ... Let's first understand XML, its structure, and how an XML parser functions to process and read data from ...
🌐
Studytonight
studytonight.com › python-howtos › how-to-read-xml-file-in-python
How to read XML file in Python - Studytonight
Let's first have a quick look over the full form of XML, introduction to XML, and then read about various parsing modules to read XML documents in Python. XML stands for Extensible Markup Language. It's needed for keeping track of the tiny to medium amount of knowledge. It allows programmers to develop their own applications to read data from other applications. The method of reading the information from an XML file and further analyzing its logical structure is known as Parsing.