3

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....

Tom Hargrave
  • 308
  • 4
  • 8

1 Answers1

6

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.

Amos M. Carpenter
  • 4,848
  • 4
  • 42
  • 72
Tom Hargrave
  • 308
  • 4
  • 8