I don't understand the need to prefix elements with the namespace if the target namespace has been declared in the schema file. Would'nt all elements belong to the target namespace by default. I would think that only references to these elements from another schema would need to be prefixed with the appropriate namespace.
I still think that 0.9.3.9 version of castor was correct and this is a bug in the newer version of castor. > -----Original Message----- > From: Keith Visco [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 06, 2002 1:27 PM > To: [EMAIL PROTECTED] > Subject: Re: [castor-dev] SourceGenerator does not recognize elements > from another schema? > > > > Based on your example schema it looks like you are having a default > namespace crisis. > > You'll need to prefix "IDType" with "ns1", as such "ns1:IDType". > > Or you can change the default namespace to > "http://multschema1.com" and > declare a prefix for the XML Schema namespace as such: > > <xsd:schema targetNamespace="http://www.multschema1.com/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns="http://www.multschema1.com/"> > <xsd:simpleType name="IDType"> > <xsd:restriction base="xsd:string"/> > </xsd:simpleType> > </xsd:schema> > > > The fact that it worked before in version 0.9.3.9, is > probably a bug in > that version. > > --Keith > > > Tahura Chaudhry wrote: > > > > I've been using castor for the last few months to generate > Java source from > > schema files. I recently updated to the latest release > version Castor > > 0.9.3.19 . Surprisingly the source generator failed to > generate the source > > files for the schemas. I have not modified the schema files > and suspect that > > this may be due to recent code fixes or enhancements to > Castor. I have > > attached below the two sample schemas the error messages as > outputted by the > > source generator. Can someone please tell me why this may > be happening and > > if there is a workaround. Thanks. > > > > ------------------- > > SCHEMA FILE 1:: > > <schema targetNamespace="http://www.multschema1.com/" > > xmlns="http://www.w3.org/2001/XMLSchema" > > xmlns:ns1="http://www.multschema1.com/"> > > <simpleType name="IDType"> > > <restriction base="string" /> > > </simpleType> > > </schema> > > > > SCHEMA FILE 2:: > > <schema targetNamespace="http://www.multschema2.com/" > > xmlns="http://www.w3.org/2001/XMLSchema" > > xmlns:ns1="http://www.multschema1.com/" > > xmlns:ns2="http://www.multschema2.com/"> > > <import namespace="http://www.multschema1.com/" > > schemaLocation="multSchema1.xsd" /> > > <element name="someElement" type="ns2:someElementType"/> > > <complexType name="someElementType"> > > <attribute name="ID" type="ns1:IDType" > use="required" /> > > </complexType> > > </schema> > > > > ERROR :: > > -- Suppressing non fatal warnings. > > > > Warning: Do not forget to generate source code for the > following imported > > schema: d:/schemas/others/multSchema1.xsd > > Exception in thread "main" java.lang.IllegalArgumentException: > > getSimpleType: the simple type 'IDType' is not a built-in t > > ype as defined in XML Schema specification. > > at > > org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:838) > > at > > org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:859) > > at > > > org.exolab.castor.xml.schema.SimpleTypeReference.resolveTypeRe > ference(Simple > > TypeReference.java:102) > > at > > > org.exolab.castor.xml.schema.SimpleTypeReference.getType(Simpl > eTypeReference > > .java:92) > > at > > > org.exolab.castor.xml.schema.AttributeDecl.getSimpleType(Attri > buteDecl.java: > > 223) > > at > > > org.exolab.castor.builder.SourceFactory.processAttributes(Sour > ceFactory.java > > , Compiled Code) > > at > > > org.exolab.castor.builder.SourceFactory.processComplexType(Sou > rceFactory.jav > > a:1355) > > at > > > org.exolab.castor.builder.SourceFactory.createSourceCode(Sourc > eFactory.java: > > 444) > > at > > > org.exolab.castor.builder.SourceGenerator.processComplexType(S > ourceGenerator > > .java, Compiled Code) > > at > > > org.exolab.castor.builder.SourceGenerator.createClasses(Source > Generator.java > > , Compiled Code) > > at > > > org.exolab.castor.builder.SourceGenerator.createClasses(Source > Generator.java > > , Compiled Code) > > at > > > org.exolab.castor.builder.SourceGenerator.generateSource(Sourc > eGenerator.jav > > a:366) > > at > > > org.exolab.castor.builder.SourceGenerator.generateSource(Sourc > eGenerator.jav > > a:424) > > at > > > org.exolab.castor.builder.SourceGenerator.generateSource(Sourc > eGenerator.jav > > a:453) > > at > > > org.exolab.castor.builder.SourceGenerator.main(SourceGenerator > .java:696) > > > > > > > > > -------------------------------------------------------------- > --------------------------------------------------- > > The information contained in this message is confidential > and is intended > > for the addressee(s) only. If you have received this > message in error or > > there are any problems please notify the originator > immediately. The > > unauthorised use, disclosure, copying or alteration of this > message is > > strictly forbidden. Baltimore Technologies plc will not be > liable for > > direct, special, indirect or consequential damages arising > from alteration of the > > contents of this message by a third party or as a result of > any virus being > > passed on. > > > > This footnote confirms that this email message has been > swept for Content Security threats, including > > computer viruses. > > > > http://www.baltimore.com > > > > > > This footnote confirms that this email message has been swept by > > Baltimore MIMEsweeper for Content Security threats, including > > computer viruses. > > > > ----------------------------------------------------------- > > If you wish to unsubscribe from this mailing, send mail to > > [EMAIL PROTECTED] with a subject of: > > unsubscribe castor-dev > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev