users@jaxb.java.net

Ordering of enum values in XJC

From: Kenny MacLeod <kennym_at_kizoom.com>
Date: Wed, 26 Jul 2006 21:32:41 +0100

If I have a schame with the following type:

     <simpleType name="TestEnum">
         <restriction base="NMTOKEN">
             <enumeration value="b"/>
             <enumeration value="a"/>
             <enumeration value="c"/>
         </restriction>
     </simpleType>

The when XJC turns this into a java enum type, then it will re-arrange
the enumeration values into alphabetical order:

@XmlEnum
public enum TestEnum {

     @XmlEnumValue("a")
     A("a"),
     @XmlEnumValue("b")
     B("b"),
     @XmlEnumValue("c")
     C("c");
}

While I appreciate that the permitted enum values in the XML Schema are
not strictly speaking ordered, the values in a java enum type are.

Is there any reason why XJC couldn't retain the ordering of enum values
in the generated java? Information is being lost during the translation.

Should I file an issue for this?


kenny