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.


----- Original Message ----- From: "Ralf Joachim" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, January 21, 2006 4:58 AM
Subject: Re: [castor-user] [XML] Duplicate XML names in SourceGenerator


Hi Richard,

here I hope to be able to help a little.

SourceGenerator generates classes for every complex type and element. The classes are named the same as the name of the complex type or element. In your case it wants to create:

- a class 'ClaimsCost' for
 <xs:complexType name="ClaimsCost">

- a class 'ClaimsCost' for
<xs:complexType name="ServiceType">
  <xs:sequence>
    <xs:element name="ClaimsCost" type="ClaimsCost"/>
  </xs:sequence>
</xs:complexType>


- a class 'ClaimsCost' for
<xs:complexType name="RxLevel">
  <xs:sequence>
    <xs:element name="ClaimsCost" type="ClaimsCost"/>
  </xs:sequence>
</xs:complexType>

As you may understand it is not possible to create 3 different classes with the same name in the same package. This is what the binding file is for, it allows you to tell SourceGenerator to give each class of the above cases a different name.

A name clash may not only occure on class level but also on properties of a class.

Ralf



Fishman, Richard schrieb:

Bill, I don't understand how that would help. My main problem is that I
just don't understand what the warning message is trying to tell
me...why SourceGenerator is having an issue...

-----Original Message-----
From: Bill Leng [mailto:[EMAIL PROTECTED] Sent: Friday, January 20, 2006 2:38 PM
To: [email protected]
Subject: Re: [castor-user] [XML] Duplicate XML names in SourceGenerator

I would change your schema to something like
<xs:complexType name="ClaimsCostType">
>> <xs:attribute name="value" type="xs:string"
>>use="required"/>
>> </xs:complexType>
>> <xs:complexType name="ServiceType">
>> <xs:sequence>
>> <xs:element name="ClaimsCost"
>>type="ClaimsCostType"/>
>> </xs:sequence>
>> </xs:complexType>
>> <xs:complexType name="RxLevel">
>> <xs:sequence>
>> <xs:element name="ClaimsCost"
>>type="ClaimsCost"/>
>> </xs:sequence>
>> </xs:complexType>
>></xs:schema>
>>
>>

Ralf Joachim wrote:

That's a thing I have to leave for others as I haven't used this myself until now.

Ralf


Fishman, Richard schrieb:


Thanks Ralf.

That's what I thought (mapping-binding.xml) but I can't figure out how

to do it...
-----Original Message-----
From: Ralf Joachim [mailto:[EMAIL PROTECTED]
Sent: Friday, January 20, 2006 1:13 PM
To: [email protected]
Subject: Re: [castor-user] [XML] Duplicate XML names in SourceGenerator

Hi Richard,

I#M not an expert on the XML side of castor but as far as I know you

should be able to resolve all of this warnings yb a binding file with 1
or 2 bindings.

For an example you may want to take a look at:

src/main/org/exolab/castor/mapping/mapping-binding.xml

Regards
Ralf
Castor JDO, committer


Fishman, Richard schrieb:



I'm definitely no expert on XML Schema and don't completely understand all the name collision issues that SourceGenerator must have to deal with but I can definitely understand the issues it would



have with some name duplications. But I can't understand why I am having the problem below. Why wouldn't SourceGenerator just create a ClaimsCost class and add it as a member variable to both the

ServiceType and RxLevel classes?

I read the SourceGenerator docs but it wasn't completely intuitive on



how to get around this in a generic fashion. I can't create a binding



for each of the warnings I'm getting because there are literally hundreds of them. The namingXML seems to be my ticket but I can't understand how to use it.

Here are some excerpts from an xsd (the whole xsd is HUGE with many includes so I hesitate to include it in the post):

<?xml version="1.0" encoding="UTF-8"?> <xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:complexType name="ClaimsCost">
<xs:attribute name="value" type="xs:string"
use="required"/>
</xs:complexType>
<xs:complexType name="ServiceType">
<xs:sequence>
<xs:element name="ClaimsCost"
type="ClaimsCost"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RxLevel">
<xs:sequence>
<xs:element name="ClaimsCost"
type="ClaimsCost"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

Here are the warnings:
Warning: A class name generation conflict has occured between element



'complexTy pe:RxLevel/ClaimsCost' and complexType 'complexType:ClaimsCost'. Please use a Bi nding file to solve this problem.Continue anyway [not recommended] (y|n|?)y


Warning: A class name generation conflict has occured between element



'complexTy pe:ServiceType/ClaimsCost' and complexType 'complexType:ClaimsCost'.
Please use
a Binding file to solve this problem.Continue anyway [not recommended] (y|n|?)y


Warning: A class name generation conflict has occured between element



'complexTy pe:ServiceType/ClaimsCost' and complexType 'complexType:ClaimsCost'.
Please use
a Binding file to solve this problem.Continue anyway [not recommended] (y|n|?)y


Warning: A class name generation conflict has occured between element



'complexTy pe:RxLevel/ClaimsCost' and complexType 'complexType:ClaimsCost'. Please use a Bi nding file to solve this problem.Continue anyway [not recommended] (y|n|?)y


Warning: A class name generation conflict has occured between element



'complexTy pe:ServiceType/ClaimsCost' and complexType 'complexType:ClaimsCost'.
Please use
a Binding file to solve this problem.Continue anyway [not recommended] (y|n|?)y


Warning: A class name generation conflict has occured between element



'complexTy pe:RxLevel/ClaimsCost' and complexType 'complexType:ClaimsCost'. Please use a Bi nding file to solve this problem.Continue anyway [not recommended] (y|n|?)y

Regards,

Rick Fishman Technical Architecture Services
DCC 6-5 203, Ext. 51987
e-mail: [EMAIL PROTECTED]
Phone: (904) 905-1987
Website: http://tas.bcbsfl.com




Blue Cross Blue Shield of Florida, Inc., and its subsidiary and

affiliate companies are not responsible for errors or omissions in this
e-mail message. Any personal comments made in this e-mail do not reflect
the views of Blue Cross Blue Shield of Florida, Inc.  The information
contained in this document may be confidential and intended solely for
the use of the individual or entity to whom it is addressed.  This
document may contain material that is privileged or protected from
disclosure under applicable law.  If you are not the intended recipient
or the individual responsible for delivering to the intended recipient,
please (1) be advised that any use, dissemination, forwarding, or
copying of this document IS STRICTLY PROHIBITED; and (2) notify sender
immediately by telephone and destroy the document. THANK YOU.


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

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




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

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







Blue Cross Blue Shield of Florida, Inc., and its subsidiary and affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc. The information contained in this document may be confidential and intended solely for the use of the individual or entity to whom it is addressed. This document may contain material that is privileged or protected from disclosure under applicable law. If you are not the intended recipient or the individual responsible for delivering to the intended recipient, please (1) be advised that any use, dissemination, forwarding, or copying of this document IS STRICTLY PROHIBITED; and (2) notify sender immediately by telephone and destroy the document. THANK YOU.



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

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


-------------------------------------------------
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