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 - ET has two classes for this purpose - ElementTree represents the whole XML document as a tree, and Element represents a single node in this tree. Interactions with the whole document (reading and writing to/from files) are usually done on the ElementTree level.
🌐
GeeksforGeeks
geeksforgeeks.org › python › reading-and-writing-xml-files-in-python
Reading and Writing XML Files in Python - GeeksforGeeks
January 12, 2026 - 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.
🌐
DEV Community
dev.to › cloudytech147 › parse-read-xml-document-in-python-94l
Parse/Read XML Document in Python - DEV Community
October 6, 2021 - In this Python XML tutorial, we will stroll through the Python XML minidom and ElemetnTree modules, and figure out how to parse a XML document in Python.
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.read_xml.html
pandas.read_xml — pandas 3.0.1 documentation
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. Valid URL schemes include http, ftp, s3, and file. ... The XPath to parse required set of nodes for migration to DataFrame.``XPath`` should return a collection of elements and not a single element. Note: The etree parser supports limited XPath expressions. For more complex XPath, use lxml which requires installation. ... The namespaces defined in XML document as dicts with key being namespace prefix and value the URI.
🌐
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
🌐
PyPI
pypi.org › project › beautifulsoup4
beautifulsoup4 · PyPI
>>> from bs4 import BeautifulSoup >>> soup = BeautifulSoup("<p>Some<b>bad<i>HTML") >>> print(soup.prettify()) <html> <body> <p> Some <b> bad <i> HTML </i> </b> </p> </body> </html> >>> soup.find(string="bad") 'bad' >>> soup.i <i>HTML</i> # >>> soup = BeautifulSoup("<tag1>Some<tag2/>bad<tag3>XML", "xml") # >>> print(soup.prettify()) <?xml version="1.0" encoding="utf-8"?> <tag1> Some <tag2/> bad <tag3> XML </tag3> </tag1> To go beyond the basics, comprehensive documentation is available. ... Beautiful Soup's support for Python 2 was discontinued on December 31, 2020: one year after the sunset date for Python 2 itself.
      » pip install beautifulsoup4
    
Published   Nov 30, 2025
Version   4.14.3
Find elsewhere
🌐
Rdegges
rdegges.com › 2013 › quickly-extract-xml-data-with-python
Randall Degges - Quickly Extract XML Data with Python
Instead of going the LXML route, ... using Python’s built in xml.etree module. It’s got a (relatively) simple interface that makes parsing simple XML documents fairly easy – and since that’s all I needed to do, it seemed like a good solution. If you’re looking for a quick way to extract XML data, read ...
🌐
NetworkAcademy
networkacademy.io › learning path: ccna automation (200-901) ccnaauto › data formats and data models › parsing xml with python
Parsing XML with Python | NetworkAcademy.IO
First, we need to read the file with ElementTree. xml = ET.parse('interfaces.xml') root = xml.getroot() Then, if we print the object we can see that we have an ‘ElementTree’ object at a specified memory address: >>> print(xml) <xml.etree.ElementTree.ElementTree object at 0x0364AEE0> Once ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › modify-xml-files-with-python
Modify XML files with Python - GeeksforGeeks
July 15, 2025 - XML is an inherently hierarchical data format, and the most natural way to represent it is with a tree.To perform any operations like parsing, searching, modifying an XML file we use a module xml.etree.ElementTree .It has two classes.ElementTree represents the whole XML document as a tree which helps while performing the operations. Element represents a single node in this tree.Reading and writing from the whole document are done on the ElementTree level.Interactions with a single XML element and its sub-elements are done on the Element level.
🌐
Runestone Academy
runestone.academy › ns › books › published › py4e-int › web › parsingXML.html
15.2. Parsing XML — Python for Everybody - Interactive
The triple single quote ('''), as well as the triple double quote ("""), allow for the creation of strings in Python that span multiple lines. Calling fromstring converts the string representation of the XML into a “tree” of XML elements. When the XML is in a tree, we have a series of methods we can call to extract portions of data from the XML string.
🌐
GitHub
github.com › microsoft › markitdown
GitHub - microsoft/markitdown: Python tool for converting files and office documents to Markdown. · GitHub
The DocumentConverter class interface has changed to read from file-like streams rather than file paths. No temporary files are created anymore. If you are the maintainer of a plugin, or custom DocumentConverter, you likely need to update your code. Otherwise, if only using the MarkItDown class or CLI (as in these examples), you should not need to change anything. MarkItDown is a lightweight Python utility for converting various files to Markdown for use with LLMs and related text analysis pipelines.
Starred by 91.8K users
Forked by 5.5K users
Languages   Python 99.7% | Dockerfile 0.3%
🌐
Zyte
zyte.com › learn › a-practical-guide-to-xml-parsing-with-python
A Practical Guide to Python XML Parsing
No external installation is required, as it’s part of the Python Standard Library. bash ... 2.lxml (optional): A more powerful XML and HTML handling library. It supports XPath and XSLT, making it ideal for complex use cases. bash ... Once you’ve got your environment ready, we’ll proceed to the basic tasks of loading and parsing XML data using Python.
🌐
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 › index.html
The Python Standard Library — Python 3.14.3 documentation
xmlrpc.server — Basic XML-RPC servers · ipaddress — IPv4/IPv6 manipulation library · Multimedia Services · wave — Read and write WAV files · colorsys — Conversions between color systems · Internationalization · gettext — Multilingual internationalization services ·
🌐
Python
python.org › about › apps
Applications for Python | Python.org
HTML and XML · JSON · E-mail processing. Support for FTP, IMAP, and other Internet protocols. Easy-to-use socket interface. And the Package Index has yet more libraries: Requests, a powerful HTTP client library. Beautiful Soup, an HTML parser that can handle all sorts of oddball HTML.
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › scenarios › xml
XML parsing — The Hitchhiker's Guide to Python
can be loaded into a Python dict like this: 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.
🌐
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.