This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Convenient XML creation using objects

Project Description

Convert objects to XML quickly and easily.

Features

  • Easily convert objects using an XML template.
  • Supports node lists and sub-documents.
  • Objects don’t need to know about XML paths, flat objects can become deep XML documents.
  • Dynamically inject XML at creation time.

Examples

Simple document:

from obj2xml import XML_Object, XML_Property, XML_TextProperty


class MyExampleXML(XML_Object):
    version = XML_Property(['root', 'version'], 1.0)
    test_value = XML_Property(['root', 'test-value'], 'Default Value')
    no_default_value = XML_Property(['root', 'no-default'])

    text_node = XML_TextProperty(['root', 'text-node-1'])
    manual_text_node = XML_Property(['root', 'text-node-2', '_text'])

obj = MyExampleXML()
obj.test_value = 'Another value'
obj.no_default_value = 'This value was hidden before'
obj.a_text_value = 'Over-rode the default text'
obj.text_node = 'This is some text'
obj.manual_text_node = 'This is some more text'

print(obj)

<?xml version="1.0" ?>
<root no-default="This value was hidden before" test-value="Another value" version="1.0">
  <text-node-2>This is some more text</text-node-2>
  <text-node-1>This is some text</text-node-1>
</root>

For further examples, look in the examples directory.

Dependencies

Authors

Release History

Release History

This version
History Node

1.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
obj2xml-1.0.1.tar.gz (3.4 kB) Copy SHA256 Checksum SHA256 Source May 13, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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