Sebastian,

it looks like you are being hit by a mix between a bug and a feature.
And I am 100% sure that's not the kind of answer you have been looking for.

But there's a work-around available: simply start using a binding file
during code generation, and provide a different Java member name for one
for one of the attribute definitions. This could look similar to

<elementBinding name="/<element-name>/@x>
   <member name="x1" />
</elementBinding>

Regards
Werner

Sebastian Gomez wrote:
> Hi everyone.
> I'm thinking about using Castor in one of my company's projects, but I'm
> having quite an important problem in one of my proof of concepts. I'm using
> Maven's Castor Plugin (castor-maven-plugin 1.0) to generate java classes
> from some XSD files I can't modify. The thing is one of those files contains
> two attributes with the same name, but one starts with an underscore and the
> other one doesn't. Something like the following:
> 
> <xs:element ....>
>      <xs:attribute name="x" .... />
>      <xs:attribute name="_x" .... />
> </xs:element>
> 
> When the java class generation is being done I get  an error saying
> "duplicate name found _x". I think this is because Castor appends the
> underscore only to those attributes that don't start with the underscore.
> Why doesn't Castor name my Java variable "__x"?
> 
> Is it possible to change the prefix Castor uses for the java attributes
> created or simply to not use prefixes?
> 
> Thanks in advance for your help.
> 
> Sebastian Gomez.
> 

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

    http://xircles.codehaus.org/manage_email


Reply via email to