stchris / Untangle
Licence: mit
Converts XML to Python objects
Stars: ✭ 499
Programming Languages
python
139335 projects - #7 most used programming language
Projects that are alternatives of or similar to Untangle
Fluidxml
FluidXML, the PHP library for manipulating XML with a concise and fluent API.
Stars: ✭ 417 (-16.43%)
Mutual labels: xml
Devpi
Python PyPi staging server and packaging, testing, release tool
Stars: ✭ 444 (-11.02%)
Mutual labels: pypi
Camaro
camaro is an utility to transform XML to JSON, using Node.js binding to native XML parser pugixml, one of the fastest XML parser around.
Stars: ✭ 438 (-12.22%)
Mutual labels: xml
Wikiteam
Tools for downloading and preserving wikis. We archive wikis, from Wikipedia to tiniest wikis. As of 2020, WikiTeam has preserved more than 250,000 wikis.
Stars: ✭ 404 (-19.04%)
Mutual labels: xml
Corexlsx
Excel spreadsheet (XLSX) format parser written in pure Swift
Stars: ✭ 481 (-3.61%)
Mutual labels: xml
Soapengine
This generic SOAP client allows you to access web services using a your iOS app, Mac OS X app and AppleTV app.
Stars: ✭ 468 (-6.21%)
Mutual labels: xml
untangle
- Converts XML to a Python object.
- Siblings with similar names are grouped into a list.
- Children can be accessed with
parent.child
, attributes withelement['attribute']
. - You can call the
parse()
method with a filename, an URL or an XML string. - Substitutes
-
,.
and:
with_
<foobar><foo-bar/></foobar>
can be accessed withfoobar.foo_bar
,<foo.bar.baz/>
can be accessed withfoo_bar_baz
and<foo:bar><foo:baz/></foo:bar>
can be accessed withfoo_bar.foo_baz
- Works with Python 2.7 and 3.4, 3.5, 3.6, 3.7, 3.8 and pypy
Installation
With pip:
pip install untangle
With conda:
conda install -c conda-forge untangle
Conda feedstock maintained by @htenkanen. Issues and questions about conda-forge packaging / installation can be done here.
Usage
(See and run examples.py or this blog post: Read XML painlessly for more info)
import untangle
obj = untangle.parse(resource)
resource
can be:
- a URL
- a filename
- an XML string
Running the above code and passing this XML:
<?xml version="1.0"?>
<root>
<child name="child1"/>
</root>
allows it to be navigated from the untangle
d object like this:
obj.root.child['name'] # u'child1'
Changelog
see CHANGELOG.md
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].