Skip to main content

A simple xml parse and build library.

Project description

Brief

alt Latest Version alt License alt Downloads Build Status

A simple xml parse and build library.

Installation

pip install lazyxml

Examples

  • xml to python object
>>> import lazyxml
>>> xml = '<demo><foo>foo</foo><bar>bar</bar></demo>'
>>> lazyxml.loads(xml)
{'bar': 'bar', 'foo': 'foo'}
>>> lazyxml.loads(xml, strip_root=False)
{'demo': {'bar': 'bar', 'foo': 'foo'}}
>>> xml = '<demo><foo>foo</foo><bar>1</bar><bar>2</bar></demo>'
>>> lazyxml.loads(xml)
{'bar': ['1', '2'], 'foo': 'foo'}
  • python object to xml
>>> data = {'demo':{'bar': ['1', '2'], 'foo': '<foo>'}}
>>> lazyxml.dumps(data)
'<?xml version="1.0" encoding="utf-8"?><demo><foo><![CDATA[<foo>]]></foo><bar><![CDATA[1]]></bar><bar><![CDATA[2]]></bar></demo>'
>>> lazyxml.dumps(data, cdata=False)
'<?xml version="1.0" encoding="utf-8"?><demo><foo>&lt;foo&gt;</foo><bar>1</bar><bar>2</bar></demo>'
>>> print lazyxml.dumps(data, indent=' ' * 4)
<?xml version="1.0" encoding="utf-8"?>
<demo>
   <foo><![CDATA[<foo>]]></foo>
   <bar><![CDATA[1]]></bar>
   <bar><![CDATA[2]]></bar>
</demo>

Documentation

See docs in readthedocs

Changelog

See changelog

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

lazyxml-1.3.2.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

lazyxml-1.3.2-py2-none-any.whl (9.3 kB view details)

Uploaded Python 2

File details

Details for the file lazyxml-1.3.2.tar.gz.

File metadata

  • Download URL: lazyxml-1.3.2.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.1 requests/2.26.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/2.7.18

File hashes

Hashes for lazyxml-1.3.2.tar.gz
Algorithm Hash digest
SHA256 cdc7c6ebcef85abd73c52ace006c8efb4b7bb377dbd82cc232e4d3708b5ff20f
MD5 02b19e9b53db28fd05907e0cae51c6f7
BLAKE2b-256 13082346e0082fedda12f3dbb19694760f32af6adae0d60880e0d5c1c775e198

See more details on using hashes here.

File details

Details for the file lazyxml-1.3.2-py2-none-any.whl.

File metadata

  • Download URL: lazyxml-1.3.2-py2-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.1 requests/2.26.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/2.7.18

File hashes

Hashes for lazyxml-1.3.2-py2-none-any.whl
Algorithm Hash digest
SHA256 aec93d37740fc80032756e2c586a7062ed1439133424b4f3def1c01a47f7d8fd
MD5 9b739e2722768e87fe00ddf9b9e91d64
BLAKE2b-256 9b0d39226e75c1e94c3f1155151286bc75598e813e5bb519b511c25223de62ca

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page