Ciao Francesco,

as per default naming conventions applied during XML code generation, Castor will create the following Java members for both of the attribute definitions:

        private String _id;

Please note that this is top of my head, as I will have to verity this later on (where it is the String return type where I might be wrong).

As such, one attribute would clearly overwrite the other one, and as such produce incorrect code. IN order to avoid this, an error message is emitted, signalling this abnormality to you.

Having said that, you should be able to resolve this naming collision by using a binding file, and specifying that e.g. the Java member generated for the second attribute definition should be named 'secondId'. Have you tried that already ?

Regards
Werner

Francesco Vivoli wrote:
Follow up, sorry for the duplication.


In fact the schema has these two definitions:

            <xsd:attribute name="id" type="xsd:NCName" use="optional"/>
            <!-- the 'Id' attribute is needed for XML-Signature -->
            <xsd:attribute name="Id" type="xsd:ID" use="optional"/>

for the same complex type...
Is there a way I could override the default behavior and have a valid
mapping? F


Francesco Vivoli wrote:
Hi

I've been trying to use Castor to generate java bindings for this schema:

http://nvd.nist.gov/scap/xccdf/docs/xccdf-1.0.xsd.txt

The problem is, I get the following output:

Embedded error: An Exception occurred processing
/Users/villo/Documents/projects/atalaya/trunk/atalaya-web/src/main/xsd/xccdf-1.0.xsd
duplicate name found: _id


In fact the schema has these two definitions:

            <xsd:attribute name="id" type="xsd:NCName" use="optional"/>
            <!-- the 'Id' attribute is needed for XML-Signature -->
<xsd:attribute name="Id" type="xsd:ID" use="optional"/>
for the same complex type...

I'm using Castor-1.1.M3 with the maven plugin with these properties (I
used the last two in the hope to solve the problem but I admit I don't
know their effect too much)

org.exolab.castor.builder.javaVersion=5.0
org.exolab.castor.builder.automaticConflictResolution=true

I have read http://www.mattpayne.org/blog/category/programming/xml/ here that people have been using xmlbeans to generate java bindings for this
schema, but I'd like to use Castor, as I have just to make data binding...

Is there a way I could override the default behavior and have a valid
mapping?
thanks a lot
F






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

   http://xircles.codehaus.org/manage_email

Reply via email to