Thanks for the response and information.  The example I gave was very
simple, to make clear what I wanted.  Actually, I am using XMLBeans to wrap
the Universal Business Language (UBL 1.0) schemas, which have enumerations
with nearly 100 values, for example, "30" (maps to X_30) can mean "Buyer
disagrees with due date" or "AF" can mean "U.S. Defense Switched Network".
I just don't think a comment will work, so I will be writing some scripts to
do the renaming.

Incidentally, the definitions are contained in the schema annotation
elements, so a method of selecting sub elements of <annotation> with XPath
and injecting their content into the javadoc comments would also be nice :).

Dave

-----Original Message-----
From: Radu Preotiuc-Pietro [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 13, 2005 6:17 PM
To: [email protected]
Subject: RE: Changing enumeration names

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]




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

Reply via email to