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 db0905

Examples

  • xml to python object
>>> import db0905
>>> xml = '<demo><foo>foo</foo><bar>bar</bar></demo>'
>>> db0905.loads(xml)
{'bar': 'bar', 'foo': 'foo'}
>>> db0905.loads(xml, strip_root=False)
{'demo': {'bar': 'bar', 'foo': 'foo'}}
>>> xml = '<demo><foo>foo</foo><bar>1</bar><bar>2</bar></demo>'
>>> db0905.loads(xml)
{'bar': ['1', '2'], 'foo': 'foo'}
  • python object to xml
>>> data = {'demo':{'bar': ['1', '2'], 'foo': '<foo>'}}
>>> db0905.dumps(data)
'<?xml version="1.0" encoding="utf-8"?><demo><foo><![CDATA[<foo>]]></foo><bar><![CDATA[1]]></bar><bar><![CDATA[2]]></bar></demo>'
>>> db0905.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 db0905.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

cpz-1.0.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

cpz-1.0.1-py2-none-any.whl (28.9 kB view details)

Uploaded Python 2

File details

Details for the file cpz-1.0.1.tar.gz.

File metadata

  • Download URL: cpz-1.0.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.5

File hashes

Hashes for cpz-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c0f519790308f57a009e19951a0a79bd10acca15ee1b9da03138b7e42f7209dc
MD5 6afdc6ee6a294414d7556fb6e8f8f4e8
BLAKE2b-256 b265b81ee9321840545b7562275666fd350f944f67558194f1869a043954d53f

See more details on using hashes here.

File details

Details for the file cpz-1.0.1-py2-none-any.whl.

File metadata

  • Download URL: cpz-1.0.1-py2-none-any.whl
  • Upload date:
  • Size: 28.9 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/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.5

File hashes

Hashes for cpz-1.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 4f1813687519cb34ebd24fc508e079e790409d8ff485dd8f5dfc99b56d156ea5
MD5 adf8cd12c43b5b6706f5c4cb2a8517b5
BLAKE2b-256 9d12ee84c3a7638202ff1419887b072ce42a697dd2d52264f51baf60ab3fa4fc

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