# pyxjustiz

a python library for [XJustiz](https://xjustiz.justiz.de/)

basically just dataclasses for the xml files generated by xsdata

## dependencies

- [xsdata](https://xsdata.readthedocs.io/en/latest/)

## usage

```python
# parse handelsregister xml
from xsdata.formats.dataclass.parsers import XmlParser
from xjustiz.model_gen import NachrichtReg0400003

parser = XmlParser()
message = parser.from_path("YY-XYZ_HRB_12345+SI-200109111234.xml", NachrichtReg0400003)

# turn dataclass back into xml
from xsdata.formats.dataclass.serializers import XmlSerializer
from xsdata.formats.dataclass.serializers.config import SerializerConfig

serializer = XmlSerializer(config=SerializerConfig(pretty_print=True))
data = serializer.render(message)
```

## maintenance

xjustiz will update every once in a while (see the release cycle [here](https://xjustiz.justiz.de/index.php))

once a new version is released, put the xsd files into the xsd directory and run
`bash model_gen.sh`
to update the models.
