Hi Keith, Thanks. That seems to have resolved the problem. The only problem I have now is that I have a complex type 'Addressee' in one namespace which extends a complex type 'Addressee' in a different namespace.
An unmarshall method gets generated for each type which has a different type returned. One returns the superclass, the other returns the subclass. This obviously causes a problem. We never actually need to instantiate the super class so a possible solution is simply to remove the unmarshall method in the generated superclass. This fixes the problem but is something I obviously would prefer not to do. Is this a recommended solution? Are there alternatives? Ive included the unmarshall methods which get generated below... This method is in the Address subclass: public static com.claude.schema.castor.slac.Addressee unmarshalAddressee(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (com.claude.schema.castor.slac.Addressee) Unmarshaller.unmarshal(com.claude.schema.castor.slac.Addressee.class, reader); } This method is in the Address super class: public static com.claude.schema.castor.sl.Addressee unmarshalAddressee(java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (com.claude.schema.castor.sl.Addressee) Unmarshaller.unmarshal(com.claude.schema.castor.sl.Addressee.class, reader); } Thanks Claudio Mio -----Original Message----- From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: 16 January 2002 21:57 Subject: Re: [castor-dev] Question re: sourceGen of a schema with complex types and no top level element. Hi Claudio, This is a known problem. Your schema is valid, but Castor has a problem when it encounters elements and complexTypes with the same name. One thing you might want to do is try using the "type" method (see castorbuilder.properties), since the type method doesn't try to create classes for all elements. The element method will always create classes for elements. --Keith Claudio Mio wrote: > > Hi, > > I am trying to sourceGen the attached schema. However am encountering a > problem where the complex type Tpsdata is having a class for it created > twice (the second one overwriting the first). An abstract one and a subclass > which tries to extend the same abstract class. Ive read through the doc but > there doesn't seem to be any similar examples. > > The attached schema fragment is from a schema which has a number of complex > types for use by top level schema. > > Ive also included the castorbuilder.properties file I am using. > > Any help would be much appreciated. > > Thanks > Claudio Mio > > SLOrigoTypes.xsd: > ============= > <xs:schema targetNamespace="http://www.origoservices.com" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:origo="http://www.origoservices.com" elementFormDefault="unqualified" > attributeFormDefault="unqualified"> > <xs:simpleType name="AddressLine"> > <xs:restriction base="xs:string"> > <xs:maxLength value="35"/> > </xs:restriction> > </xs:simpleType> > <xs:simpleType name="Country"> > <xs:restriction base="xs:string"> > <xs:maxLength value="35"/> > </xs:restriction> > </xs:simpleType> > <xs:simpleType name="Postcode"> > <xs:restriction base="xs:string"> > <xs:pattern value="[A-Z]{1,2}\d{1,2}\s\d{1,2}[A-Z]{2}"/> > </xs:restriction> > </xs:simpleType> > <xs:complexType name="Tpsdata"> > <xs:sequence> > <xs:any namespace="##any" processContents="lax" id="tpsdata" > minOccurs="0"/> > </xs:sequence> > <xs:attribute name="id" type="xs:ID" use="optional"/> > </xs:complexType> > <xs:complexType name="Address"> > <xs:sequence> > <xs:element name="line_1" type="origo:AddressLine" minOccurs="0"/> > <xs:element name="line_2" type="origo:AddressLine" minOccurs="0"/> > <xs:element name="line_3" type="origo:AddressLine" minOccurs="0"/> > <xs:element name="line_4" type="origo:AddressLine" minOccurs="0"/> > <xs:element name="country" type="origo:Country" minOccurs="0"/> > <xs:element name="postcode" type="origo:Postcode" minOccurs="0"/> > <xs:element name="tpsdata" type="origo:Tpsdata" minOccurs="0"/> > </xs:sequence> > <xs:attribute name="id" type="xs:ID"/> > </xs:complexType> > </xs:schema> > > castorbuilder.properties: > =================== > org.exolab.castor.builder.javaclassmapping=element > > org.exolab.castor.builder.nspackages=\ > http://www.origoservices.com=com.claude.schema.castor.origo,\ > http://www.standardlife.com/XMLSchema/SLAC=com.claude.schema.castor.slac,\ > http://www.standardlife.com/XMLSchema/notification=com.claude.schema.castor. > notification,\ > http://www.standardlife.com/XMLSchema/SL=com.claude.schema.castor.sl > > org.exolab.castor.builder.equalsmethod=true ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev