Unfortunately, the level of customization allowed by .xsdconfig is
currently not finely grained enough to make it possible to rename
enumeration fields, so I am afraid you are stuck using "A", "B" and "C".
I wouldn't go to all the trouble of changing the generated code if I
were you, I would just add a comment when using it.

Radu

-----Original Message-----
From: David Smalley [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 13, 2005 11:08 AM
To: XMLBeans
Subject: 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to