users@jaxb.java.net

Subject: Ordering of enum values/xsd attributes in XJC

From: jason white <jason_white_01_at_hotmail.com>
Date: Mon, 14 Aug 2006 14:08:26 +0000

Can someone please tell me if this was addressed?





--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:

--_at_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

I am looking at a similar problem where I have an xsd that lays out
attributes in an order similar to:

- A
- C
- B

and xjc generates object with attributes in the order of (which is not
desired):

-A
-B
-C

-jason