A simple xml parse and build library.
Project description
Brief
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><foo></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
Changelog
See changelog
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
db0905-1.0.0.tar.gz
(11.3 kB
view details)
Built Distribution
db0905-1.0.0-py2-none-any.whl
(19.2 kB
view details)
File details
Details for the file db0905-1.0.0.tar.gz
.
File metadata
- Download URL: db0905-1.0.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 296f56e1d529c3af8a22226ef3477809c0c641c63d3c97b719785e249882da5d |
|
MD5 | 2c6b7d18f6218fd8d4aad0775aa44cc0 |
|
BLAKE2b-256 | dbcbceaa6180a273845783ee368349820fa940b23e411b02bc14edbb352adc17 |
File details
Details for the file db0905-1.0.0-py2-none-any.whl
.
File metadata
- Download URL: db0905-1.0.0-py2-none-any.whl
- Upload date:
- Size: 19.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56bb7c4463fba7ac764c527efdff05e280855d47e94385e10f5f96ad84214aa0 |
|
MD5 | 3f59894431f623a6c1170cd11a552f8e |
|
BLAKE2b-256 | 5d4e893ff96c3a2dd45a7c4e243548c6848fddb31d9bedea761be2108242c0fd |