XML tree builder
Project description
Pure pythonic tree structure model builder.
Enter tree nodes with python contextmanagers.
Export the tree to given (one or many) markup builders.
Enjoy 1:1 translation from python to given markup.
Example
from xplant.xml import XmlPlant x = XmlPlant() with x.node("section_a", attribute_1=1): with x.node("nested_1", empty=True): pass with x.node("nested_2"): x.comment("Can handle also comments.") for number in range(3): x.leaf("a number {:02}".format(number), num=number) print(x)
Will give:
<section_a attribute_1="1"> <nested_1 empty="true"></nested_1> <nested_2> <!-- Can handle also comments. --> <a number 00 num="0" /> <a number 01 num="1" /> <a number 02 num="2" /> </nested_2> </section_a>
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
xplant-0.1.1.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for xplant-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40194352b459b74737373f83c7be3b91d4a655ebce29be5dbeb2519bc705a733 |
|
MD5 | 31e055bd8a6c86dd0a2f5c35fcac68d5 |
|
BLAKE2b-256 | 84c11b4ce2850f7e735488eb2c881d77a4e0d205d53ce48ae3d3d43ad493ae30 |