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!

UNKNOWN

Project Description

Converts XML to Python objects.

Installation

pip install unwind

Example

We have following XML file and we desire to parse it:

<?xml version="1.0" encoding="UTF-8"?>
<page>
    <menu>
        <name aaa="bbb" ccc="ddd">Привет мир</name>
        <items>
            <item>
                <name rel="lala">Пункт 1</name>
                <url>http://example1.com</url>
            </item>
            <item>
                <name>Пункт 2</name>
                <url>http://example2.com</url>
            </item>
        </items>
    </menu>
    <spec-sy.mbols>Символы</spec-sy.mbols>

</page>

In Python:

Load XML from file:

>>> import unwind
>>> page = unwind.parse("example.xml")

Load XML from string:

>>> xml = """
        <?xml version="1.0" encoding="UTF-8"?>
        <root />
    """
>>> page = unwind.fromstring(xml)

Get some text:

>>> page.menu.name.get_text()

Get some attrs:

>>> page.menu.name['aaa']
>>> page.menu.name['ccc']

Get list:

>>> page.menu.items.get_children()

Iterate through a list:

>>> for item in page.menu.items:
>>>     print item.name.get_text()
Release History

Release History

This version
History Node

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
unwind-0.1.tar.gz (2.2 kB) Copy SHA256 Checksum SHA256 Source Mar 24, 2013

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