Python XJustiz XML models from official XSDs with easy parsing, serialization, and validation.
Project description
pyxjustiz
pyxjustiz provides Python dataclasses for XJustiz XML messages, automatically generated from the official XSD schemas. It simplifies working with the complex XJustiz standard by providing a type-safe way to parse, validate, and generate compliant XML messages.
🌟 Overview
Working with the XJustiz standard can be challenging due to its complexity and the sheer volume of message types. pyxjustiz bridges this gap by offering a comprehensive set of Python dataclasses generated using xsdata.
With pyxjustiz, you get:
- Full IDE Support: Enjoy autocompletion and type checking for all XJustiz message types.
- Type Safety: Avoid manual XML manipulation and catch errors early in the development process.
- Ease of Use: Focus on your business logic instead of worrying about the underlying XML structure.
✨ Features
- XJustiz 3.6.0: Currently supports the latest stable version of the XJustiz standard.
- Automatic Model Generation: Dataclasses are generated directly from the official XSD schemas.
- Seamless Integration: Designed to work perfectly with the
xsdataparser and serializer. - Clean API: Provides a natural and intuitive way to handle complex legal data structures in Python.
🚀 Installation
You can install pyxjustiz using pip:
pip install pyxjustiz
Or using uv:
uv add pyxjustiz
📖 Usage
Using pyxjustiz to handle XJustiz messages is straightforward. Here are examples of parsing and serialization.
Parsing an XJustiz Message
from xsdata.formats.dataclass.parsers import XmlParser
from xjustiz.model_gen import NachrichtReg0400003
# Initialize the XML parser
parser = XmlParser()
# Load and parse an XJustiz XML file
# For example, a Handelsregister message (NachrichtReg0400003)
message = parser.from_path("YY-XYZ_HRB_12345+SI-200109111234.xml", NachrichtReg0400003)
# Access data using native Python attributes
print(f"Successfully parsed message: {message}")
Serializing back to XML
from xsdata.formats.dataclass.serializers import XmlSerializer
from xsdata.formats.dataclass.serializers.config import SerializerConfig
# Configure the serializer for pretty-printed output
config = SerializerConfig(pretty_print=True)
serializer = XmlSerializer(config=config)
# Render the dataclass back into an XML string
xml_output = serializer.render(message)
🛠 Maintenance & Updates
The XJustiz standard is updated periodically (see the official release cycle). To update the models in this library when a new version is released:
- Place the new XSD files into the
xsd/directory. - Run the generation script:
bash model_gen.sh
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyxjustiz-1.1.0.tar.gz.
File metadata
- Download URL: pyxjustiz-1.1.0.tar.gz
- Upload date:
- Size: 297.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d1f8667f67236e0088976554ad74561eecd2bce34bfe58b7e119e9d4d6ff6c8
|
|
| MD5 |
e7f995ce62f0cbd2af19be52c78058b8
|
|
| BLAKE2b-256 |
61921f5b994c122fdb91fae48453446cb3f903fc7ec900ecb4a442e6896cbfde
|
Provenance
The following attestation bundles were made for pyxjustiz-1.1.0.tar.gz:
Publisher:
publish.yml on nbdy/pyxjustiz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxjustiz-1.1.0.tar.gz -
Subject digest:
3d1f8667f67236e0088976554ad74561eecd2bce34bfe58b7e119e9d4d6ff6c8 - Sigstore transparency entry: 843432072
- Sigstore integration time:
-
Permalink:
nbdy/pyxjustiz@2077b781698bac1120e74161fb128a1bafa39287 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/nbdy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2077b781698bac1120e74161fb128a1bafa39287 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyxjustiz-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pyxjustiz-1.1.0-py3-none-any.whl
- Upload date:
- Size: 352.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c73a4816ace05c1c948e425a26aa6b15018aba72b806cb0506405ed69e88c76e
|
|
| MD5 |
500ac26671655df82a6d4bfe2c4b113d
|
|
| BLAKE2b-256 |
34ca239c4952cb0ad3019159c9c64f36c57fc96802d015ed969665e3c99e3524
|
Provenance
The following attestation bundles were made for pyxjustiz-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on nbdy/pyxjustiz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxjustiz-1.1.0-py3-none-any.whl -
Subject digest:
c73a4816ace05c1c948e425a26aa6b15018aba72b806cb0506405ed69e88c76e - Sigstore transparency entry: 843432074
- Sigstore integration time:
-
Permalink:
nbdy/pyxjustiz@2077b781698bac1120e74161fb128a1bafa39287 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/nbdy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2077b781698bac1120e74161fb128a1bafa39287 -
Trigger Event:
push
-
Statement type: