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.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

lazyxml-1.3.0-py2-none-any.whl (12.4 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: lazyxml-1.3.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/2.7.16

File hashes

Hashes for lazyxml-1.3.0.tar.gz
Algorithm Hash digest
SHA256 b55ab99964ccc01c897af77504a19d50e3867c8ae913432a4529761e0df7a1ce
MD5 3c9bf7a4e8089ee60278e2fffc98bcae
BLAKE2b-256 370beddc245a69c2828c989df9eb832701e1d729de9102249f189631e337469a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lazyxml-1.3.0-py2-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/2.7.16

File hashes

Hashes for lazyxml-1.3.0-py2-none-any.whl
Algorithm Hash digest
SHA256 08e1ad8e8dd8ed11e7fa0bc8eb9c5250b20fa795a3e95922a1f95637806a9eeb
MD5 d7befd9052ab2a1a708682ac15923a19
BLAKE2b-256 c2dd801a0158b5eca35c6b94dd2fb1a6114b20389d620d2a37d52ece1f220e9b

See more details on using hashes here.

Supported by

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