It might not be your exact problem, but if you have two elements with the
same name and then
use the SourceGenerator to generate the java classes, then you need to
provide an override for the normal Java class name - otherwise you'll end up
with two classes generated but the last will overwrite the first. 

Specify the override in a binding file,  e.g

bindingDuplicates.xml  :- 


<?xml version="1.0"?>
<!-- This file contains the binding information -->
<!-- for the invoice XML Schema -->
<!-- It is meant to be used by the Castor Source Code Generator -->

<cbf:binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding";
             defaultBindingType='element'>

     <!-- Binding the element to a class -->
     <cbf:elementBinding name="/CTP/AIP/REQUEST">
        <cbf:java-class name="RequestAIP"/>
     </cbf:elementBinding>
     
     <!-- Binding the element to a class -->     
     <cbf:elementBinding name="/CTP/FAF/REQUEST">
        <cbf:java-class name="RequestFAF"/>
     </cbf:elementBinding>    
         
</cbf:binding>


where name=  is the xpath to the duplicated element

then pass this binding file into the SourceGenerator e.g.

java -classpath %JAVACLASSPATH% org.exolab.castor.builder.SourceGenerator -i
C:/XML/XMLSchemas/your.xsd -package com.yourpackage -dest src -types j2
-binding-file bindingDuplicates.xml


when you marshall back to XML the original element name will be intact. It
took me ages to get this working, it really should be documented somewhere.


Pete


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2003 16:22
To: [EMAIL PROTECTED]
Subject: [castor-dev] Duplicate names found in schema


I am working on a schema that contains an element with an attribute and
multiple child elements.  The name of one of the child elements is the same
as the attribute.  The code generation process can't complete because of the
duplicate names.  Any suggestions how to solve this problem?

Thanks!

ND

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev
This transmission is confidential and intended solely for the person or
organisation to whom it is addressed.  It may contain privileged and
confidential information.  If you are not the intended recipient, you should
not copy, distribute or take any action in reliance on it. If you have
received this transmission in error, please notify the sender immediately.
Any opinions or advice contained in this e-mail are those of the individual
sender except where they are stated to be the views of RDF Group or EMS plc.
All messages passing through this gateway are virus scanned.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to