xmlutil icon indicating copy to clipboard operation
xmlutil copied to clipboard

[feature for future] Automatic generation of class hierarchy from xml schema

Open altavir opened this issue 6 years ago • 5 comments
trafficstars

This feature requires some additional work and external tool, but I am putting it here just to track it. It is possible to generate Kotlin class file compatible with kotlinx.serialization from xml schema. We should consider doing it in future. It will also help to cover different use-cases.

altavir avatar Jul 07 '19 08:07 altavir

Of course it would be useful to add the reverse as well (schema from classes). That should be easier to achieve. I'll have to check the state of the code generator (when I have time). The API should support it at this moment, but it was the case that SerialInfo was not implemented completely.

On XML Schema, I'd be happy for some to work, but it is likely that we would be limited to a subset of xml schema. The way it works isn't quite the way that Kotlin/Java type hierarchies work, but supporting a common part of it is certainly possible..

pdvrieze avatar Jul 09 '19 06:07 pdvrieze

The just released version actually builds a full representation of the types. This should make the opposite case (schema from code) quite feasible. That is certainly the easier case, but I don't see why this could not also be used to generate kotlin classes for the schema.

pdvrieze avatar Aug 19 '20 23:08 pdvrieze

Schema from classes is also quite useful.

altavir avatar Aug 20 '20 05:08 altavir

Hi. Any news about this feature release date?

It will be very useful to have alternative to Java XJC + Krasa plugin in Kotlin multi-platform, to have Kotlin classes with validations and text captions from XSD instead of JAXB + JSR303. If you require, I can provide good complex XSD example.

EMaksymenko avatar Mar 18 '21 16:03 EMaksymenko

I haven't started on this (work comes first, especially over adding features). Of course a good example would be helpful, but I don't think that I'll be able to put much time in it soon.

pdvrieze avatar Mar 19 '21 10:03 pdvrieze