This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
XMLBuilder is tiny library build on top of ElementTree.TreeBuilder to
make xml files creation more pythonomic. `XMLBuilder` use `with`
statement and attribute access to define xml document structure.
Only 2.5+ python versions are supported.

from __future__ import with_statement # only for python 2.5
from xmlbuilder import XMLBuilder

x = XMLBuilder('root')
x.some_tag
x.some_tag_with_data('text', a='12')

with x.some_tree(a='1'):
with x.data:
x.mmm
for i in range(10):
x.node(val=str(i))

etree_node = ~x # <= return xml.etree.ElementTree object
print str(x) # <= string object

will result:


<root>
<some_tag/>
<some_tag_with_data a="12">text</some_tag_with_data>
<some_tree a="1">
<data>
<mmm/>
<node val="0"/>
<node val="1"/>
<node val="2"/>
<node val="3"/>
<node val="4"/>
<node val="5"/>
<node val="6"/>
<node val="7"/>
<node val="8"/>
<node val="9"/>
</data>
</some_tree>
</root>

There some fields, which allow xml output customization:

formatted = produce formatted xml. default = True
tabstep = tab string, used for formatting. default = ' ' * 4
encoding = xml document encoding. default = 'utf-8'
xml_header = add xml header
()
to begining of the document. default = True
builder = builder class, used for create dcument. Default =
xml.etree.ElementTree.TreeBuilder

Options can be readed by

x = XMLBuilder('root')
print x[option_name]

and changed by

x[option_name] = new_val

Look at xmlbuilder/test.py for UT and more examples.
Happy xml'ing.
Release History

Release History

1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
xmlbuilder-1.0.tar.gz (4.3 kB) Copy SHA256 Checksum SHA256 Source Dec 14, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting