I have the following schema which I would like to create an enum class
<xs:simpleType name="TopicValuesType">
<xs:union memberTypes="xs:string">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="APPLE"/>
<xs:enumeration value="BANANA"/>
<xs:enumeration value="ORANGE"/>
<xs:enumeration value="#"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:complexType name="TopicType">
<xs:attribute name="name" type="TopicValuesType" use="required"/>
</xs:complexType>
I've tried to create a binding class but it doesn't work.
<bindings schemaLocation="MySchema.xsd">
<globalBindings typesafeEnumBase="xs:string" typesafeEnumMemberName="generateName" />
</bindings>
I've read this post XJC does not generate enum inside xs:union where it's not possible to create enum.
Is there any other way to create enum out of this schema? Unfortunately I'm unable to edit the schema because it's from a third party.
I'm using maven jaxb2
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>