I'm using the 1.0 version of the plugin with castor-1.0.4, here's the
relevant pom.xml snippet:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>castor-maven-plugin</artifactId>
        <version>1.0</version>
        <dependencies>
            <dependency>
                <groupId>org.codehaus</groupId>
                <artifactId>castor</artifactId>
                <version>1.0.4</version>
            </dependency>
        </dependencies>

I'll try your simpleTypeBinding name="/enumType:Inquiry_Status" syntax
in my current setup and then see what happens if I bump up to castor-1.2

-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 10, 2008 4:12 AM
To: [email protected]
Subject: Re: [castor-user] Is there a known case-sensitivty issue with
code generated data types?

What version of the Maven plugin are you using ? And what version of
Castor does the plugin actually source ?

Werner

Thomas Vaughan wrote:
> Thanks for the pointer, Werner.
> 
> I tried following up on that advice, but ran in to some trouble. .
> .perhaps you can quickly spot something I'm doing wrong?
> 
> I get this error when running the maven goal:
>       Unable to load a binding file due to the following:
>       unable to find FieldDescriptor for 'simpleTypeBinding' in
> ClassDescriptor of binding
>       The Source Generator will continue with no binding file.
> 
> My binding file looks like:
> <binding xmlns="http://www.castor.org/SourceGenerator/Binding"; 
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
>  
> xsi:schemaLocation="http://www.castor.org/SourceGenerator/Binding
>                              http://www.castor.org/binding.xsd"; 
>          defaultBinding="element">
> 
>    <simpleTypeBinding name="/Inquiry_Status">
>       <java-class name="Foo"/>
>    </simpleTypeBinding>           
> </binding>
> 
> 
> The simple type I'm trying to play around with is:
>       <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>
> 
> 
> The problem seems to live with the "simpleTypeBinding" . . . if I try
an
> elementBinding on an element, it works fine.
> 
> 
> 
> Thanks!
> Tom
> 
> 
> 
> P.S. I know that <java-class> isn't going to solve my particular
> problem, but I'm just trying to get something to work correctly on
these
> simpleTypes before digging too much deeper.  
> 
> P.P.S. I'll get rid of the http://www.castor.org/binding.xsd xsi
> schemaLocation. . .it's just there in a development context.
> 
> -----Original Message-----
> From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 14, 2008 2:57 PM
> To: [email protected]
> Subject: Re: [castor-user] Is there a known case-sensitivty issue with
> code generated data types?
> 
> 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
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 

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

    http://xircles.codehaus.org/manage_email



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

    http://xircles.codehaus.org/manage_email


Reply via email to