Comprehensive XML generator for Python
Project description
Project Name
Comprehensive XML generator for Python
Table of Contents
Installation
pip install xml-generator
Usage
Import
from xml_generator.types import XmlNode
Comprehensive parsing
Parse Comprehensive format into an XmlNode object.
node = XmlNode.parse(
{
"name": "node",
"attributes": {"attr1": "value1", "attr2": "value2"},
"body": [
{"name": "child1", "attributes": {"attr1": "value1"}},
{"name": "child2", "attributes": {"attr2": "value2"}},
],
}
)
Searching a specific node
Return the first XmlNode with the given query. Query can be a name with attributes.
parent = node.find("node")
child1 = node.find("child1@attr1")
child2 = node.find("child2")
Generate a xml file
Using the to_xml()
function that return the XmlNode as an XML string.
with open('sample.xml', 'w', encoding='utf-8') as f:
f.write(node.to_xml())
Contributing
Coming soon.
Testing
python -m unittest discover -s xml_generator/tests -p "test*.py"
Building
python .\setup.py sdist bdist_wheel
Deployment
twine upload dist/*
License
License :: OSI Approved :: MIT License
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
Built Distribution
Close
Hashes for xml-generator-seobaeksol-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea50dfef43851c312497af904cbc1f7e4406490bba17215bdce91443b2c2791e |
|
MD5 | cadc31be595a8110ae3b5c2c0aff8c2e |
|
BLAKE2b-256 | 2561c1b35d350421fb71e9bed036e6e2c9aa0b3d738c11e3e54f6b5c05da18e6 |
Close
Hashes for xml_generator_seobaeksol-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a25b1a33c79d7ca4d91143f1c98d13f193d90da467ec1f3bb4440d9d501a81e |
|
MD5 | 2dd1a76572ccaa532457bc67b49e220b |
|
BLAKE2b-256 | 2f16970d4433207764709ddd70c701495574314b49fa25b4661998c74ae75d15 |