Metadata-Version: 2.4
Name: pyxjustiz
Version: 1.1.0
Summary: Python XJustiz XML models from official XSDs with easy parsing, serialization, and validation.
Author-email: nbdy <me@nbdy.io>
License: This is free and unencumbered software released into the public domain.
        
        Anyone is free to copy, modify, publish, use, compile, sell, or
        distribute this software, either in source code form or as a compiled
        binary, for any purpose, commercial or non-commercial, and by any
        means.
        
        In jurisdictions that recognize copyright laws, the author or authors
        of this software dedicate any and all copyright interest in the
        software to the public domain. We make this dedication for the benefit
        of the public at large and to the detriment of our heirs and
        successors. We intend this dedication to be an overt act of
        relinquishment in perpetuity of all present and future rights to this
        software under copyright law.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
        IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
        OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
        ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
        OTHER DEALINGS IN THE SOFTWARE.
        
        For more information, please refer to <https://unlicense.org/>
        
Project-URL: Homepage, https://github.com/nbdy/pyxjustiz
Project-URL: Documentation, https://github.com/nbdy/pyxjustiz
Project-URL: Source, https://github.com/nbdy/pyxjustiz
Project-URL: Issues, https://github.com/nbdy/pyxjustiz/issues
Keywords: xjustiz,xml,schemas,xsdata,pydantic
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: xsdata[cli]>=26.1
Dynamic: license-file

# pyxjustiz

<p align="center">
  <a href="https://pypi.org/project/pyxjustiz/">
    <img src="https://img.shields.io/pypi/v/pyxjustiz.svg" alt="PyPI version">
  </a>
  <a href="https://pypi.org/project/pyxjustiz/">
    <img src="https://img.shields.io/pypi/pyversions/pyxjustiz.svg" alt="Python versions">
  </a>
  <a href="https://github.com/nbdy/pyxjustiz/blob/master/LICENSE">
    <img src="https://img.shields.io/github/license/nbdy/pyxjustiz.svg" alt="License">
  </a>
  <a href="https://github.com/nbdy/pyxjustiz/actions/workflows/publish.yml">
    <img src="https://github.com/nbdy/pyxjustiz/actions/workflows/publish.yml/badge.svg" alt="Build Status">
  </a>
</p>

`pyxjustiz` provides Python dataclasses for [XJustiz](https://xjustiz.justiz.de/) 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](https://xsdata.readthedocs.io/).

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`:

```bash
pip install pyxjustiz
```

Or using `uv`:

```bash
uv add pyxjustiz
```

## 📖 Usage

Using `pyxjustiz` to handle XJustiz messages is straightforward. Here are examples of parsing and serialization.

### Parsing an XJustiz Message

```python
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

```python
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](https://xjustiz.justiz.de/index.php)). 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
   bash model_gen.sh
   ```
