Hi Alex,
In this situation you need to write a small binding file so that the SourceGenerator can create different classes for the elements. For more information on the binding file please see: http://castor.exolab.org/sourcegen.html#Binding-File Here's a quick sample: <?xml version="1.0"?> <cbf:binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding" defaultBindingType='element'> <!--define the {namespace,package} binding <cbf:package> <cbf:name></cbf:name> <cbf:namespace></cbf:namespace> </cbf:package> --> <cbf:elementBinding name="/type1/organization"> <cbf:java-class name="Org1"/> </cbf:elementBinding> <cbf:elementBinding name="/type2/organization"> <cbf:java-class name="Org2"/> </cbf:elementBinding> </cbf:binding> You supply the binding file on the command line to the SourceGenerator: java org.exolab.castor.builder.SourceGenerator -i schema.xsd -binding-file binding.xml Hope that helps, --Keith Alex Burmester wrote: > > Hi, I may have run across a bug but then again I may just not understand > how castor deals with multiple elements with the same name: > > Here's my test case: > run the following xml schema file through castor source generator 0.9.5.3 > and 0.9.5.2 The generated file Organization.java extends orgType1 in one > case and orgType2 in the other case. > > Now I would love do just remove all duplicate element names from my schema > but unfortunately it is a vendor supplied one and they seem hellbent on > making my life miserable by using duplicate named elements all over the > place. > > Thanks for any help or info. > > Alex. > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema targetNamespace="http://www.mytest.com/2003/aaa" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns="http://www.mytest.com/2003/aaa" elementFormDefault="qualified" > attributeFormDefault="unqualified"> > <xs:complexType name="type1"> > <xs:sequence> > <xs:element name="organization" type="orgType1"/> > </xs:sequence> > </xs:complexType> > <xs:complexType name="orgType1"> > <xs:sequence> > <xs:element name="e1" type="xs:string" minOccurs="0"/> > </xs:sequence> > </xs:complexType> > <xs:complexType name="type2"> > <xs:sequence> > <xs:element name="organization" type="orgType2" > minOccurs="0"/> > </xs:sequence> > </xs:complexType> > <xs:complexType name="orgType2"> > <xs:sequence> > <xs:element name="e2" type="xs:string" minOccurs="0"/> > </xs:sequence> > </xs:complexType> > </xs:schema> > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-user ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-user
