python-xmlschema
Port variant v14
Summary XML Schema validator and decoder (3.14)
Package version 4.3.2
Homepage https://github.com/sissaschool/xmlschema
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v15
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 27 NOV 2026, 01:15:48 UTC
Port created 27 NOV 2026, 01:15:48 UTC
Subpackage Descriptions
single ********* xmlschema ********* .. xmlschema-introduction-start The *xmlschema* library is an implementation of [XML Schema] for Python. This library arises from the needs of a solid Python layer for processing XML Schema based files for `MaX (Materials design at the Exascale) `_ European project. A significant problem is the encoding and the decoding of the XML data files produced by different simulation software. Another important requirement is the XML data validation, in order to put the produced data under control. The lack of a suitable alternative for Python in the schema-based decoding of XML data has led to build this library. Obviously this library can be useful for other cases related to XML Schema based processing, not only for the original scope. The full `xmlschema documentation is available on "Read the Docs" `_. Features ======== This library includes the following features: * Full XSD 1.0 and XSD 1.1 support * Building of XML schema objects from XSD files * Validation of XML instances against XSD schemas * Decoding of XML data into Python data and to JSON * Encoding of Python data and JSON to XML * Data decoding and encoding ruled by converter classes * An XPath based API for finding schema's elements and attributes * Support of XSD validation modes *strict*/*lax*/*skip* * XML attacks protection using an XMLParser that forbids entities * Access control on resources addressed by an URL or filesystem path * Downloading XSD files from a remote URL and storing them for offline use * XML data bindings based on DataElement class * Static code generation with Jinja2 templates Installation ============ You can install the library with *pip* in a Python environment:: pip install xmlschema The library uses the Python's ElementTree XML library and requires [elementpath] additional package. The base schemas of the XSD standards are included in the package for working offline and to speed-up the building of schema instances. .. xmlschema-introduction-end Usage ===== Import the library and then create a schema instance using the path of the file containing the schema as argument: .. code-block:: pycon >>> import xmlschema >>> my_schema = xmlschema.XMLSchema('tests/test_cases/examples/vehicles/vehicles.xsd') .. note:: For XSD 1.1 schemas use the class `XMLSchema11`, because the default class `XMLSchema` is an alias of the XSD 1.0 validator class `XMLSchema10`. The schema can be used to validate XML documents: .. code-block:: pycon >>> my_schema.is_valid('tests/test_cases/examples/vehicles/vehicles.xml') True >>> my_schema.is_valid('tests/test_cases/examples/vehicles/vehicles-1_error.xml') False >>> my_schema.validate('tests/test_cases/examples/vehicles/vehicles-1_error.xml') Traceback (most recent call last): File "", line 1, in File "/home/brunato/Development/projects/xmlschema/xmlschema/validators/xsdbase.py", line 393, in validate raise error xmlschema.validators.exceptions.XMLSchemaValidationError: failed
Configuration Switches (platform-specific settings discarded)
PY314 ON Build using Python 3.14 PY315 OFF Build using Python 3.15
Package Dependencies by Type
Build (only) python314:dev:std
python-pip:single:v14
autoselect-python:single:std
Build and Runtime python314:primary:std
Runtime (only) python-elementpath:single:v14
Download groups
main mirror://PYPIWHL/5c/fb/8be39dc47b0ed9bbc80f384906eed87fa974c9b377a7a430118c3b405550
Distribution File Information
cf5c970a30f6ebcb3da35260e694704cc0b6794d8ace46125bb2a95e38ed9307 504613 python-src/xmlschema-4.3.2-py3-none-any.whl
Ports that require python-xmlschema:v14
python-sbom:v14 Tree shaking for the minimal viable SBOM (3.14)