lxmlbind
Python LXML object binding.
[](https://travis-ci.org/jessemyers/lxmlbind)
What is this?
The [xml.etree][1] library is a great way to manipulate XML in Python, but in most domains it is clearer to use objects that model your domain entities instead of manipulating the XML representation directly. The motivating example was [Jenkins][2] XML job configurations, but the same problem is likely to exist for any XML-based modeling.
This project attempts to use Python [data descriptors][3] to bind an element tree to Python objects.
[1]: http://lxml.de/tutorial.html [2]: http://jenkins-ci.org/ [3]: http://docs.python.org/2/howto/descriptor.html
Example
Assume that you have an API using XML representations of people with first and last names:
xml = “<person><first>John</first><last>Doe</last></person”
lxmlbind makes it easy to define a Person object that maps to this structure:
from lxmlbind.api import Base, Property
- class Person(Base):
first = Property(“first”) last = Property(“last”)
Instances of Person wrap an lxml.etree and support manipulation of this structure through instance attributes:
# create the person from XML person = Person.from_xml(xml)
# get the first name attribute assert person.first == “John”
# set the last name attribute person.last = “Smith”
# print the resulting XML print person.to_xml()
# delete the first name entirely del person.first
Metadata
Release files for lxmlbind 2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lxmlbind-2.0.tar.gz | 11.8 kB | Without provenance | Details for lxmlbind-2.0.tar.gz |
Release files / lxmlbind-2.0.tar.gz
| Download URL | lxmlbind-2.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a57f41488a13d27f48ab2dc2133bc04f278a26f543fe332911ce51460e1c7334
|
|
BLAKE2b-256 checksum How to use checksums |
d172013d8f8b21ad3a5223c9784c3cbdcd7160c5ddeeecd6340fcbdd92924737
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lxmlbind 2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.