Utilities for using XPath to map XML data to Python objects and Django forms

emory-libraries emory-libraries Last update: Aug 29, 2022

eulxml

package
PyPILicensePyPI downloads
documentation
Documentation Status
code
travis-ci buildCode CoverageCode Climate

eulxml is a Python module that providesutilities and classes for interacting with XML that allow thedefinition of re-usable XML objects that can be accessed, updated andcreated as standard Python types, and a form component for editing XMLwith Django forms.

eulxml.xpath provides functions and classes for parsing XPathexpressions using PLY.

eulxml.xmlmap makes it easier to map XML to Python objects in anicer, more pythonic and object-oriented way than typical DOM accessusually provides. XML can be read, modified, and even created fromscratch (in cases where the configured XPath is simple enough todetermine the nodes that should be constructed).

eulxml.forms provides Django Form objects that useeulxml.xmlmap.XmlObject instances as the basis and data instancefor the form, with the goal of making it easy to edit XML contentvia web forms.

Dependencies

eulxml depends on PLY and lxml.

eulxml.forms requires and was designed to be used withDjango, although Django is notrequired for installation and use of the non-form components ofeulxml.

Contact Information

eulxml was created by the Digital Programs and Systems SoftwareTeam of Emory University Libraries.

[email protected]

License

eulxml is distributed under the Apache 2.0 License.

Development History

For instructions on how to see and interact with the full developmenthistory of eulxml, seeeulcore-history.

Developer notes

As of version 1.1, eulxml provides an XML catalogfor loading schemas referenced by included XmlObject instances. Requests is required for downloading schemas, but it is not a dependency of eulxml. Thecatalog and schemas will be included in distributed releases, but if youwant to use the catalog when installing directly from GitHub you canuse a normal pip install and then run:

python -c 'from eulxml.catalog import generate_catalog; generate_catalog()'

To install dependencies for your local check out of the code, run pip installin the eulxml directory (the use of virtualenv is recommended):

pip install -e .

If you want to run unit tests or build sphinx documentation, you will alsoneed to install development dependencies:

pip install -e . "eulxml[dev]"

To run all unit tests:

nosetests   # for normal developmentnosetests --with-coverage --cover-package=eulxml --cover-xml --with-xunit   # for continuous integration

To run unit tests for a specific module, use syntax like this:

nosetests test/test_xpath.py

To generate sphinx documentation:

cd docmake html
Tags:

Subscribe to our newsletter