I am reposting this as this seems to be a genuine bug. Any feedback?

> -----Original Message-----
> From: Kirchhoff, Florian [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, June 06, 2002 3:35 PM
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] Restriction base type not found if imported
> 
> 
> Hi.
> 
> I am using castor-0.9.3.19-xml to compile a schema using 
> SourceGenerator. I have a schema A that imports another 
> schema B. In A I have a complex type "extension" that is a 
> restriction of a complexType baseT. baseT is from a different 
> namespace since it was imported (schema are show at the end).
> 
> SourcGenerator fails with this error:
> the simple type 'baseT' is not a built-in type as defined in 
> XML Schema specification.
> 
> Looking at the code I think I see where the problem lies. 
> Here is the calling sequence:
> 
> The ComplexContentRestrictionUnmarshaller constructor calls: 
> 
> _schema.getType("qb:baseT")
> 
> which calls
> 
> getSimpleType("qb:baseT");
> 
> which calls
> 
> Schema schema = getImportedSchema(ns); 
> schema.getSimpleType(canonicalName);
> 
> Where ns is "http://www.q.com/XMLSchema/BIM"; and 
> canonicalName is "baseT".
> 
> Now in getSimpleType (now for the imported Schema object 
> (b.xsd)) name has no namespace prefix so the namespace is 
> assumed (in this case
> "http://www.w3.org/2001/XMLSchema";) and the call fails 
> because no http://www.w3.org/2001/XMLSchema:baseT type is known.
> 
> Doing this in getSimpleType solves the problem, but I am not 
> sure it's the right thing to do:
> 
> Schema schema = getImportedSchema(ns); 
> schema.getSimpleType(name); // look up the fully qualified name (with
> prefix)
> 
> How can this issue be fixed?
> 
> Thanks.
> 
> Florian Kirchhoff
> 
> ==== a.xsd ====
> <?xml version = "1.0" encoding = "UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema";
>    targetNamespace="http://www.q.com/XMLSchema";
>    xmlns:qb="http://www.q.com/XMLSchema/BIM";   
>    xmlns:qw="http://www.q.com/XMLSchema";
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>    elementFormDefault = "qualified">
> 
>   <import namespace="http://www.q.com/XMLSchema/BIM"; 
> schemaLocation = "b.xsd"/>
> 
>         <complexType name="extension">
>             <complexContent>
>               <restriction base = "qb:baseT">
>                 <sequence>
>                   <element name = "Code" minOccurs = "0">
>                     <simpleType>
>                       <restriction base = "string">
>                         <enumeration value = "GdCust"/>
>                       </restriction>
>                     </simpleType>
>                   </element>
>                 </sequence>
>               </restriction>
>             </complexContent>
>           </complexType>
> 
>   <element name = "foo" type="qw:extension"/>
> 
> </schema>
> 
> === b.xsd ===
> <?xml version = "1.0" encoding = "UTF-8"?>
> <schema xmlns="http://www.w3.org/2001/XMLSchema";
>        targetNamespace="http://www.q.com/XMLSchema/BIM";
>        xmlns:qb="http://www.q.com/XMLSchema/BIM";
>        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>        elementFormDefault = "qualified">
> 
>   <complexType name="baseT">
>     <sequence>
>       <element name="Code" type = "string" minOccurs = "0"/>
>     </sequence>
>   </complexType>
> 
> </schema>
> 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to