質問

I'm trying to reuse classes that are already compiled and available. This looks to be achievable by declaring bindings to the pre-existing classes as per example bindings extract below:-

<jaxb:bindings schemaLocation="MyExample.xsd">
    <jaxb:bindings node="//xs:simpleType[@name='MySimpleType']">
        <jaxb:class ref="com.example.MySimpleType" />
    </jaxb:bindings>
    <jaxb:bindings node="//xs:complexType[@name='MyComplexType']">
        <jaxb:class ref="com.example.MyComplexType" />
    </jaxb:bindings>
</jaxb:bindings>

The problem is that whilst complex types work just fine, the simple types are ignored and still generated....

I've tried a variety of different notations (e.g. scd) with no success on the Simple Types.

Any ideas or help very welcome....

役に立ちましたか?

解決

If the generated class you are trying to reference is an enumeration (i.e. it implements javax.xml.bind.annotation.XmlEnum), then you need to use:

jaxb:typesafeEnumClass

instead of

jaxb:class

in the bindings.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top