You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by David Smalley <sm...@adelphia.net> on 2005/10/13 20:08:02 UTC

Changing enumeration names

I have a schema which defines the following simple type:

<xsd:simpleType name="DestinationType">
  <xsd:restriction base="xsd:normalizedString">
    <xsd:enumeration value="A"/>
    <xsd:enumeration value="B"/>
    <xsd:enumeration value="C"/>
  </xsd:restriction>
</xsd:simpleType>

This generates the appropriate java class "DestinationType" with enum fields
A, B, and C.  The point is, these values are correct, because the document
requires their use (per the schema), but they're meanings are actually:

A - US Domestic
B - US Territories
C - Foreign

I would rather have enum fields in the generated type like US_Domestic,
US_Territories, and Foreign; in other words, defined as:

static final Enum US_Domestic = Enum.forString("A");
static final Enum US_Territories = Enum.forString("B");
static final Enum Foreign = Enum.forString("C");

I have looked in the FAQ and searched the mailing list.  The FAQ says the
"xb:qname" element in an xsdconfig file can be used to map elements and
attributes as well as types, but I haven't figured out how to do it or found
any examples.

Is there any way to force scomp to rename enumerations like this, or am I
stuck editing the generated code and then re-compiling?  Thanks in advance
for any insights.

Dave




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org