Skip to main content

Python XJustiz XML models from official XSDs with easy parsing, serialization, and validation.

Project description

pyxjustiz

PyPI version Python versions License Build Status

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 xsdata parser 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:

  1. Place the new XSD files into the xsd/ directory.
  2. 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

pyxjustiz-1.1.0.tar.gz (297.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyxjustiz-1.1.0-py3-none-any.whl (352.4 kB view details)

Uploaded Python 3

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

Hashes for pyxjustiz-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3d1f8667f67236e0088976554ad74561eecd2bce34bfe58b7e119e9d4d6ff6c8
MD5 e7f995ce62f0cbd2af19be52c78058b8
BLAKE2b-256 61921f5b994c122fdb91fae48453446cb3f903fc7ec900ecb4a442e6896cbfde

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxjustiz-1.1.0.tar.gz:

Publisher: publish.yml on nbdy/pyxjustiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pyxjustiz-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c73a4816ace05c1c948e425a26aa6b15018aba72b806cb0506405ed69e88c76e
MD5 500ac26671655df82a6d4bfe2c4b113d
BLAKE2b-256 34ca239c4952cb0ad3019159c9c64f36c57fc96802d015ed969665e3c99e3524

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyxjustiz-1.1.0-py3-none-any.whl:

Publisher: publish.yml on nbdy/pyxjustiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page