[](https://coveralls.io/r/alephnullplex/xml_models2?branch=master)
[Read The Docs](http://xml-models2.readthedocs.org/en/latest/)
# XmlModels2
XmlModels allows you to define Models similar in nature to Django models that are backed by XML endpoints rather than a
database. Using a familiar declarative definition, the fields map to values in the XML document by means of XPath
expressions. With support for querying external REST APIs using a django-esque approach, we have strived to make
writing and using xml backed models as close to django database models as we can, within the limitations of the
available API calls.
# Installation
The simplest approach is to to use `pip install xml_models2`
# A simple example
Just to get started, this is an example of taking an XML representation of an Address that might be returned from a
GET request to an external REST api.
<Address id="2">
<number>22</number>
<street>Acacia Avenue</street>
<city>Maiden</city>
<country>England</country>
<postcode>IM6 66B</postcode>
</Address>
class Address(xml_models.Model):
id=xml_models.IntField(xpath="/Address/@id")
number = xml_models.IntField(xpath="/Address/number")
street = xml_models.CharField(xpath="/Address/street")
city = xml_models.CharField(xpath="/Address/city")
country = xml_models.CharField(xpath="/Address/country")
postcode = xml_models.CharField(xpath="/Address/postcode")
finders = {(id,): 'http://adresses/%s'}
This example would be used as follows:-
>>> address = Address.objects.get(id=2)
>>> print "address is %s, %s" % (address.number, address.street)
"22, Acacia Avenue"
# Heritage
This project is a fork of [Django REST Models](http://djangorestmodel.sourceforge.net/)
Metadata
Release files for xml_models2 0.11.1
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 |
|---|---|---|---|---|
| xml_models2-0.11.1.zip | 13.5 kB | Without provenance | Details for xml_models2-0.11.1.zip |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xml_models2-0.11.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for xml_models2-0.11.1-py2.py3-none-any.whl |
Total release size: 26.6 kB
Release files / xml_models2-0.11.1.zip
| Download URL | xml_models2-0.11.1.zip |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45a1704fef9c03962da40b2c4a535eb974fc108c2977f856fcbbd4dae4a8cecd
|
|
BLAKE2b-256 checksum How to use checksums |
5679202fe19e3fe8b3c43fc77b74c5f1e9a7106e5060242996ba46ef2093ef89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / xml_models2-0.11.1-py2.py3-none-any.whl
| Download URL | xml_models2-0.11.1-py2.py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a801a9f0fb2598745b0039d3b88eb4830214d75275906f013055dde81a22e214
|
|
BLAKE2b-256 checksum How to use checksums |
b169060b5b9c61538173c356e02d679bce0958e373aec4ab3349a50b5badd2a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for xml_models2 0.11.1
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.