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