Re: Generate enum?

From: Aleksei Valikov <>
Date: Sun, 18 Dec 2011 22:27:50 +0100


> We have some places where we do something like:
>      <xs:element name="Status">
>        <xs:simpleType>
>          <xs:restriction base="xs:string">
>            <xs:enumeration value="APPROVED" />
>            <xs:enumeration value="UNDECIDED" />
>            <xs:enumeration value="REJECTED" />
>          </xs:restriction>
>        </xs:simpleType>
>      </xs:element>
> Is there any way to have a java enum or interface or class generated
> for those constants?

I think the inheritance plugin must be able to do this.


                <jaxb:bindings node="xsd:element[@name='issueJIIB38']">

        <xs:simpleType name="issueJIIB38Type">
                <xs:restriction base="xs:string">
                        <xs:enumeration value="a"/>
                        <xs:enumeration value="b"/>
                        <xs:enumeration value="c"/>
                        <xs:enumeration value="d"/>

        <xs:element name="issueJIIB38" type="issueJIIB38Type"/>

I'm not sure if it is enough, please file an issue if yo miss something.