Skip to main content

pyxml2obj convert xml to python object and vice versa. This module is inspired by XML::Simple in CPAN

Project description

This module provides only 2 methods, XMLin and XMLout.

XMLin convert xml to python object, and XMLout python object to xml.

This module is inspired by XML::Simple in CPAN, but some options of XML::Simple are not supported.

Simple example of usage is followings

>>> from pyxml2obj import XMLin, XMLout
>>> xml = '''
... <world>
... <country area="Asia" lang="ja">Japan</country>
... <country area="Europe" lang="fr">France</country>
... <country area="Oceania" lang="en">Australia</country>
... </world>
... '''
>>> world = XMLin(xml)
>>> print world
{u'country': [{u'area': u'Asia', 'content': u'Japan', u'lang': u'ja'},
           {u'area': u'Europe', 'content': u'France', u'lang': u'fr'},
           {u'area': u'Oceania', 'content': u'Australia', u'lang': u'en'}]}
>>> reverse = XMLout(world)
>>> print reverse
<root>
<country area="Asia" lang="ja">Japan</country>
<country area="Europe" lang="fr">France</country>
<country area="Oceania" lang="en">Australia</country>
</root>
In current version, following options are supported

[XMLin] keyattr keeproot forcecontent contentkey noattr forcearray grouptags normalizespace valueattr

[XMLout] keyattr keeproot contentkey noattr rootname xmldecl noescape grouptags valueattr

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyxml2obj-0.1.2.9.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

pyxml2obj-0.1.2.9-py2.5.egg (27.2 kB view details)

Uploaded Source

File details

Details for the file pyxml2obj-0.1.2.9.tar.gz.

File metadata

  • Download URL: pyxml2obj-0.1.2.9.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyxml2obj-0.1.2.9.tar.gz
Algorithm Hash digest
SHA256 ccbcfe9664e0a9d63f577aa6ce2b190faee2e8d3ad3497389ad3e605440e2e88
MD5 88ee48bad5fe39e65501dc43d17d23af
BLAKE2b-256 ca64866f4e96ad4d9826130397ba9d47f5ae8e9dbc873665056cd3da8111086b

See more details on using hashes here.

File details

Details for the file pyxml2obj-0.1.2.9-py2.5.egg.

File metadata

File hashes

Hashes for pyxml2obj-0.1.2.9-py2.5.egg
Algorithm Hash digest
SHA256 c876630b7dcbb2158d4b259423d10b0d777961023e28bced6674955f444d457b
MD5 21495cf0d943cc96be70b22ffc55033e
BLAKE2b-256 20733c3c21e351f263deac07ff5d09373ce2704d4e39a81b26ba761727573a7b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page