I have a XSD like the following:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.0">
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="bar">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="a"/>
<xs:enumeration value="b"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subtype" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="aa"/>
<xs:enumeration value="bb"/>
<xs:enumeration value="cc"/>
<xs:enumeration value="dd"/>
<xs:enumeration value="ee"/>
<xs:enumeration value="ff"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="something">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
but JAXB does not generate enums:
@XmlAttribute(name = "type", required = true)
protected String type;
@XmlAttribute(name = "subtype", required = true)
protected String subtype;
I'm using the maven-jaxb2-plugin
to generate the JAXB classes.
How can I generate enums in this case? Why doesn't it work out-of-the-box?
Please note that I cannot change the XML structure. I'd prefer a custom binding solution (using a xjb file), but I might be able to change the XSD as well, as long as it doesn't change the XML structure.