Thomas,

there's nothing we can do about this, as this is what we call a naming
conflict. Castor - when generating Java sources for your simple type
definition - will try to use the enumeration facet values to derive a
constant definition name. As we simply convert to upper case letters by
default, this will cause problems for you.

Having said that, you can always use a binding file to provide the
Castor code generator with a custom name for e.g. the 'Success' facet.

Regards
Werner Guttmann

Thomas Vaughan wrote:
> Hi,
> 
>  
> 
> My apologies if this is an open issue (I tried searching for this issue,
> but no luck).
> 
>  
> 
> I've got an xsd with a simpleType string like this:
> 
> <xs:simpleType name="Inquiry_Status">
> 
>       <xs:restriction base="xm:RequiredString">
> 
>             <xs:enumeration value="SUCCESS"/>
> 
>             <xs:enumeration value="Success"/>
> 
>             <xs:enumeration value="FAILED"/>
> 
>       </xs:restriction>
> 
> </xs:simpleType>
> 
>  
> 
> Notice the 2 spellings of "SUCCESS" and "Success"
> 
>  
> 
> When running the castor-maven plugin (dependent on castor-1.0.4) against
> this XSD, the generated code appears to get confused about the case
> sensitivity:
> 
>  
> 
> Notice that the 2nd spelling of "Success" gets picked up as the type but
> the 1st version gets added as a Hash key. . . 
> 
>  
> 
> public class Inquiry_Status implements java.io.Serializable {
> 
>     public static final int SUCCESS_TYPE = 1;
> 
>  
> 
>     public static final Inquiry_Status SUCCESS = new
> Inquiry_Status(SUCCESS_TYPE, "Success");
> 
>  
> 
>     public static final int FAILED_TYPE = 2;
> 
>  
> 
>     public static final Inquiry_Status FAILED = new
> Inquiry_Status(FAILED_TYPE, "FAILED");
> 
>  
> 
>     //  . . . snip . . .
> 
>  
> 
>     private static java.util.Hashtable init()
> 
>     {
> 
>         Hashtable members = new Hashtable();
> 
>         members.put("SUCCESS", SUCCESS);
> 
>         members.put("FAILED", FAILED);
> 
>         return members;
> 
>     } //-- java.util.Hashtable init() 
> 
>             
> 
>  
> 
> The "simple" answer to just change the XSD isn't, unfortunately,
> possible in this situation.  Does anyone know of a work-around or
> version fix for this problem?
> 
>  
> 
> Tom Vaughan | Technical Architect | direct 212 798 7367  | mobile 703
> 623 7101 | fax 212 966 6915   
> 
>  
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to