Introducing the LIXI Python Package
Using the LIXI Python Package (now available as a Pre-Release on the Python Package Index (PyPI) here) it has never been easier to get started with reading and validating LIXI2 messages in either XML or JSON format.
This Python package makes working with the LIXI2 data standards and with messages that are based on the LIXI2 standards incredibly easy. You can now perform lots of tasks that previously would have taken significant effort with a couple of lines of code.
This package is offered under an open-source license, however, the features are effective when used in conjunction with a LIXI2 Schema which are available to LIXI members and licensees.
The development of this package was driven by a need to simplify the most common tasks associated with the use of the LIXI2 schemas and sample messages.
Key features include the following.
- Read an XML or JSON file
- Validate an XML or JSON file against a LIXI2 Schema.
- Validate a LIXI package (XML or JSON) against a Schematron file that contains business rules (in the form of rule and assertions).
- Convert a valid LIXI2 XML file to the equivalent LIXI2 JSON representation (that conforms to a LIXI2 JSON Schema Specification).
- Convert a valid LIXI2 JSON file to the equivalent XML representation.
- Transform a LIXI2 message to an older/newer LIXI2 version or show warnings of any data loss that would occur in such a transformation.
- Create a list of all LIXI Paths that represent the elements and attributes used in a single package.
- Create a set of Customisation by Restriction instructions or schema based on a single LIXI message.
- Create a customised schema based on a set of Customisation by Restriction instructions.
- Create LIXI Schema Documentation for any LIXI2 Transaction Schema or any schema created by Customisation by Restriction.
Is it easy to install the LIXI Python Package?
Absolutely! In your development environment you install the LIXI Python Package with the following command:
pip install lixi
Is it easy to use the LIXI Python Package?
Absolutely! In your development environment you can now read and validate a LIXI2 message with the following code:
import lixi xml_obj = lixi.read_message(message_path='sample-message.xml', schema_path='LIXI-CAL-2_6_23.xsd')
Where can I get more information?
The detailed package documentation includes a Quickstart Guide that takes you through all the key functionality (available to logged in users - any member or licensee can register for a free account here).
You will also find all the code documented here (we use Sphinx to automatically generate this documentation).
LIXI holds regular training sessions (free for members), which are currently taking place online. You can get more information and see upcoming sessions here.
Finally, feel free to contact any member of the LIXI team (or use our contact form) and we will be happy to help with more information and a demonstration.
Related Blog Posts
Shane Rigby, LIXI Limited CEO
Last Updated: August 5, 2020