users@jaxb.java.net

Re: JAXB / enumerations

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Thu, 9 Oct 2008 10:57:20 +0200

Hi.

> Is it possible to convert enumerations in XML schemas to Java enum types
> with the binding compiler?
>
> <xs:simpleType name="ContractTypeCV">
> <xs:annotation>
> <xs:documentation>Contract type codes.</xs:documentation>
> </xs:annotation>
> <xs:restriction base="StringType">
> <xs:enumeration value="0" pg-md:longName="Standard"/>
> <xs:enumeration value="1" pg-md:longName="Basis"/>
> <xs:enumeration value="2" pg-md:longName="Parallel"/>
> </xs:restriction>
> </xs:simpleType>

Yes, this is done by default.
See spec 5.3, 6.2.3. You can customize enum names using
jaxb:typesafeEnumMember annotation.

Bye.
/lexi