When generating Java from an XSD via the XJC compiler, I always get the type
java.langString for elements with anonymous simpleTypes like this:
<xsd:element name="Product">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Product1"/>
<xsd:enumeration value="Product2"/>
<xsd:enumeration value="Product3"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
Of course I want like an enumeration for this. Is there a way to trick xjc
into that? The closest I have come to is by using the customization
<jxb:bindings node="//xsd:element[@name='Product']/xsd:simpleType">
<jxb:typesafeEnumClass name="ProductType" />
</jxb:bindings>
Here, XJC actually defines an enumeration ProductType, but it is not used
for the elements. 8-)
We are using JAXB 2.1.3.
(Before you ask: no, I cannot change the schema.)
Thanks so much!
--
View this message in context: http://www.nabble.com/Anonymous-simple-types-as-enums--tp22204489p22204489.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.