
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create Python objects based on an XML file?
Untangle
We can use untangle to create Python objects based on an XML file
untangle is a simple library which takes an XML document and returns a Python object which mirrors the nodes and attributes in its structure.
For example, an XML file like this −
<?xml version="1.0"?> <root> <child name="child1"> </root>
can be loaded like this −
import untangle obj = untangle.parse('path/to/file.xml')
and then you can get the child elements name like this −
obj.root.child['name']
untangle also supports loading XML from a string or an URL.
- Related Questions & Answers
- How to create animation using XML file in an Android App?
- How can I serialize python objects to XML?
- Python Pandas - Create an Index based on an underlying Categorical
- How to create animation using XML file in an Android App using Kotlin?
- Creating an array of objects based on another array of objects JavaScript
- Filter an array containing objects based on another array containing objects in JavaScript
- JavaScript Separate objects based on properties
- How to create an empty file using Python?
- How to create an ID column in R based on categories?
- How to add an attribute to the XML file using Powershell?
- How to apply XSL transformation on an XML document?
- How to group objects based on a value in JavaScript?
- How to get specific nodes in xml file in Python?
- File Objects in Python?
- How to echo XML file in PHP
Advertisements