Generate JAXB classes from XSD

Issue #9 wontfix
Julien Herr created an issue

It's more a question than an issue but I don't know where to ask it, so... :)

As you use JAXB in order to marshall and unmarshall XML to Object, why did you not generate classes from XSD instead of writing them by hand?

Comments (4)

  1. Christian Schudt repo owner

    Because a) many (at least some) XSDs in the XEP specifications are wrong (e.g. confuse xsd:choice with xsd:sequence and contradict to the written text) b) I found it easier to "just write them by hand" and I am not familiar with code generation tools. c) I wanted to have better control over the classes. E.g. if I generated classes, I probably couldn't have the abstract Stanza class, because common attributes like 'id' are separate in the schema for each stanza type. (i.e. the XSD does not reflect the hierarchy I've built, namely Message extends Stanza) d) xjc generates ObjectFactory classes, which seem unnecessary for me.

  2. Julien Herr reporter

    That makes sense! ;)

    I tried to generate classes from XSD and I had many problems I couldn't fix easily (we can customize xjc generation with xjb but what a headache!). It's not the first time I deal with "wrong" XSD and I wonder why they provide such kind of XSD...

    Thank you for your very quick answer :)

  3. Log in to comment