Thanks all. It was great help.

:-)
----- Original Message ----- From: "Keith Visco" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, January 22, 2006 10:45 AM
Subject: Re: [castor-user] [XML] Duplicate XML names in SourceGenerator



Another solution would be to use namespaces for your schema and map the namespaces to different Java packages so that your classes get generated in the appropriate packages based on the namespace schema.

This would prevent the collisions.

--Keith

Ralf Joachim wrote:
Sandeep,

may it be an option for you to switch to type method as explained at:

http://castor.codehaus.org/sourcegen.html#The-'type'-method

This does not create classes for elements whose types are top-level types.

Not sure if this helps but worse a try ;-)

Regards
Ralf


Sandeep N schrieb:

Hi Ralf, et al.

I am facing similar problem and as suggested by you, binding file definitely helps - but only when the complex-types with same names are under different hierarchy, right. But I have a situation where, there are many top level complex types with same names. These are in different schemas, but the schemas are referring each other. So I too am getting the name collision problem.

Can you please tell me how to get around this problem. Is there some way of specifying different class names for complex types when they are in top level(not under any root element) in the binding file. Or is there any other way apart from using binding file...

The following is an example of my schemas. The complex type - Nation is repeated and causes name collision : ( This is just an example. The actual xsd's are 100s of lines long and much compelx).

common.xsd :
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";

           elementFormDefault="qualified"

           attributeFormDefault="unqualified">

     <xs:element name="Nation">

     <xs:complexType>

           <xs:sequence>

                 <xs:element name="name" type="xs:string"/>

                 <xs:element name="zip" type="xs:integer"/>

           </xs:sequence>

     </xs:complexType>

     </xs:element>

     <xs:element name="id" type="xs:integer"/>

</xs:schema>

person.xsd :
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";

           elementFormDefault="qualified"

           attributeFormDefault="unqualified">

   <xs:include schemaLocation="common.xsd"/>

     <xs:element name="Person">

     <xs:complexType>

           <xs:sequence>

                 <xs:element name="name" type="xs:string"/>

                 <xs:element ref="id"/>

                 <xs:element name="address" type="xs:string"/>

           </xs:sequence>

     </xs:complexType>

     </xs:element>

     <xs:element name="Car">

     <xs:complexType>

           <xs:sequence>

                 <xs:element name="name" type="xs:string"/>

                 <xs:element name="model" type="xs:string"/>

           </xs:sequence>

     </xs:complexType>

     </xs:element>

     <xs:element name="Nation">

     <xs:complexType>

           <xs:sequence>

                 <xs:element name="name" type="xs:string"/>

                 <xs:element name="zip" type="xs:integer"/>

                 <xs:element name="age" type="xs:integer"/>

           </xs:sequence>

     </xs:complexType>

     </xs:element>

</xs:schema>

Regards
Sandeep N,

Associate Software Engineer,

Torry Harris Business Solutions.




-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------


******* DISCLAIMER: This email and any files transmitted with it are privileged 
and confidential information and intended solely for the use of the individual 
or entity to which they are addressed. If you are not the intended recipient, 
please notify the sender by e-mail and delete the original message. Further, 
you are not to copy, disclose, or distribute this e-mail or its contents to any 
other person and any such actions are unlawful. This e-mail may contain 
viruses. Torry Harris Business Solutions has taken every reasonable precaution 
to minimize this risk, but is not liable for any damage you may sustain as a 
result of any virus in this e-mail.  The recipient should check this email and 
any attachments for the presence of viruses. THBS reserves the right to monitor 
and review the content of all messages sent to or from this e-mail 
address********

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to