Hi Werner Yes, i tried that approach, but couldnt get over the issues with the XSD.
i created this binding file as you suggested to differentiate complex type from element type and i got the same error, am sure it is reading the binding file, but not sure if i my intentions in that file are imposed. Warning: A class name generation conflict has occured between complexType 'Instances' and element 'Instances'. Please use a Binding file to solve this problem.Continue anyway [not recommended] (y|n|?) <binding> <namingXML> <complexTypeName suffix = "Suggestion"/> </namingXML> </binding> Source code is as below import java.io.IOException; import org.exolab.castor.builder.FieldInfoFactory; import org.exolab.castor.builder.SourceGenerator; public class SchemaToSource { public static void main(String[] args) { SourceGenerator srcGen = new SourceGenerator( new FieldInfoFactory("arraylist")); srcGen.setDestDir("C:\\MiniMe\\OffCode\\Summa"); try { srcGen.setBinding("C:\\MiniMe\\OffCode\\Summa\\com\\cisco\\rnoc\\infovis ta\\design\\Xmls\\Binder.xml"); srcGen.generateSource("C:\\MiniMe\\OffCode\\Summa\\com\\cisco\\rnoc\\inf ovista\\design\\Xmls\\NewAD.xsd", "com.cisco.rnoc.infovista.design.topology"); } catch (IOException e) { e.printStackTrace(); } } } -----Original Message----- From: Werner Guttmann [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 5:28 PM To: dev@castor.codehaus.org Subject: Re: [castor-dev] RE: Class name Conflicts. Hi Vinodh, in my view, you should be using a binding file (you will find an example o its usage at http://castor.org/srcgen-example.html). In your particular case, it should be sufficient to instruct the Castor XML generator to append a suffix of your choice to all classes generated from (complex) type definitions. In other words, include a <namingXML> directive and specify a suffix for type names, as documented at http://castor.org/srcgen-binding.html#%3CnamingXML%3E-element Regards Werner Vinodh Rajaraman (vrajaram) wrote: > > Am very sorry, i sent the mail by mistake, sans my queries. How can i > possibly create Classes without these conflicts. > > 1. Was my approach of changing the type to a unique name partly right? > or is there a better method where Castor can generate without > conflicts 2. Am using "ArrayList" as FieldInfoFactory for all > collections. I expect Castor to generate "Instance" within "Instance" as ArrayList. > However this is where the conflict is and am unable to proceed. > 3. Should i be using a Binding file to resolve this? Will that help? > > any pointers and help would be much appreciated. > > Regards > Vinodh > > > > ---------------------------------------------------------------------- > -- > *From:* Vinodh Rajaraman (vrajaram) > *Sent:* Thursday, February 28, 2008 9:44 AM > *To:* 'dev@castor.codehaus.org' > *Subject:* Class name Conflicts. > > > Hi All > > I am using Castor Source Generator with the attached XSD, and am > getting lot of "Class name Conflicts", and for almost all elements, am > bound to get similar errors. Because, they have defined the XSD that > way, where a complex type is of the same type. > *<xs:element name="Instances" type="Instances" minOccurs="0"/>* > ** > > *Warning: A class name generation conflict has occured between > complexType 'Instances' and element 'Instances'. Please use a Binding > file to solve this problem.Continue anyway [not recommended] (y|n|?)* > > To an extent, i overcame these errors by changing the type to > InstancesType so that it doesnt confuse between element and type. I > did this for all the elements and types that had conflicts. > > *<xs:element name="Instances" type="InstancesType" minOccurs="0"/>* > > > *However, the one complex type that gives issues is as below. The > element Instance of Instance type, can contain 0 or more Instance of > the same type, Now going by my idea of changing only the types to > avoid conflicts, if i change to* > ** > > <xs:element name="*Instance*" type="*InstanceType*" minOccurs="0" > maxOccurs="unbounded"/> > > SrcGen complains of Class conflict again. > > > > <xs:complexType name="*Instance*"> > > <xs:sequence> > > <xs:element name="Description" type="xs:string" minOccurs="0"/> > > <xs:element name="Vista" type="VistaDefinitionType" minOccurs="0" > maxOccurs="unbounded"/> > > <xs:element name="Location" type="Location" minOccurs="0" > maxOccurs="1"/> > > <xs:element name="PropertyValue" type="PropertyValue" minOccurs="0" > maxOccurs="unbounded"/> > > <xs:choice minOccurs="0"> > > <xs:element name="Basic" type="BasicReferenceType" minOccurs="0"/> > > <xs:sequence> > > <xs:element name="*Instance*" type="*Instance*" minOccurs="0" > maxOccurs="unbounded"/> *---Changing this line above* > > </xs:sequence> > > </xs:choice> > > </xs:sequence> > > <xs:attribute name="Name" type="xs:string" use="optional"/> > > <xs:attribute name="Tag" type="xs:string" use="required"/> > > <xs:attribute name="VistaName" type="xs:string" use="optional"/> > > <xs:attribute name="VistaWid" type="xs:string" use="optional"/> > > </xs:complexType> > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
NewAD.xsd
Description: NewAD.xsd
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email