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

Overview

Wouldn’t it be nice to use dot notation for ElementTrees? This package allows for:

tree = ET.fromstring('<root><a><b c="asdf" /></a></root>')
a = tree.a
b = a.b
b.attrib['c'] == "asdf" # True

tree.a will be a `Element <https://docs.python.org/3.4/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element>`__ with the extra `__getattr__ <https://github.com/arve0/objectifiedetree/blob/master/objectifiedetree/__init__.py#L11-12>`__ method. This means that you can use the element as you would do normally, but names in your XML that crases with python’s methods or attributes must be accessed through tree.find(xpath).

This package uses the python implementation of etree, which makes it slower than etree found in CPython. An alternative would be to monkey-patch the built-in with forbiddenfruit, but I haven’t looked into this.

objectifiedetree has copied the python implementation of etree from CPython 3.4 Lib/xml/etree and will probably only work with Python 3.4.

Installation

Install using pip

pip install objectifiedetree

Example

from objectifiedetree import *

tree = ET.parse('/path/to/file.xml')
# dot notation :-)
el = tree.xpath.to.your.element

# use normal etree attributes
print(el.attrib)

# access name crashes
attrib_el = el.find('./attrib')

Development

Install dependencies and link development version of objectifiedetree to pip:

git clone https://github.com/arve0/objectifiedetree
cd objectifiedetree
pip install -r requirements.txt # install dependencies and objectifiedetree-package

Testing

tox

Build documentation locally

To build the documentation:

pip install -r docs/requirements.txt
make docs
Release History

Release History

0.0.1

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

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
objectifiedetree-0.0.1-py2.py3-none-any.whl (25.4 kB) Copy SHA256 Checksum SHA256 3.4 Wheel May 18, 2015
objectifiedetree-0.0.1.tar.gz (27.6 kB) Copy SHA256 Checksum SHA256 Source May 18, 2015

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