You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jeehong Min <je...@parasoft.com> on 2004/09/23 20:31:41 UTC

Schema Loading Question

I am using Xerces to load schemas that are described in WSDLs.  Below is a representation:

<wsdl:definition>
<wsdl:types>

<xs:schema targetNamespace="a">
<xs:import namespace="b"/>
</xs:schema>
<xs:schema targetNamespace="b">
<xs:import namespace="a"/>
</xs:schema>

</wsdl:types>
</wsdl:definition>
   
Note that there are 2 schemas and they reference each other via import.
 
So here is my problem.  When I load the schema "a" using XMLSchemaLoader.loadGrammar(XMLInputSource), Xerces tells me that it cannot resolve the types that are defined in schema "b".  Likewise, if I try to load schema "b" first, then Xerces cannot resolve types defined in schema "a".

If I save these inline schemas in WSDLs to a file and add the correct schemaLocation attribute to the import element, Xerces loads the schemas fine.  

My question is: is there a way to load these schemas (without having to save them to file and adding the schemaLocation attribute) in a way that Xerces can resolve the types properly?  I have access to these schemas in memory (as org.w3c.dom.Node).

Any help is much appreciated!

--
Jeehong Min

Re: Schema Loading Question

Posted by Jeehong Min <je...@parasoft.com>.
Thanks.  That works great!

- Jeehong

----- Original Message ----- 
From: "Nikhil Dinesh" <ni...@seas.upenn.edu>
To: <xe...@xml.apache.org>
Sent: Thursday, September 23, 2004 3:30 PM
Subject: Re: Schema Loading Question


> >
>> Note that there are 2 schemas and they reference each other via import.
>>
>> So here is my problem.  When I load the schema "a" using 
>> XMLSchemaLoader.loadGrammar(XMLInputSource), Xerces tells me that it 
>> cannot resolve the types that are defined in schema "b".  Likewise, if I 
>> try to load schema "b" first, then Xerces cannot resolve types defined in 
>> schema "a".
>>
>
> If you havent done it already, you should sent the entityResolver on the
> XMLSchemaLoader and then load one of the schemas. This is because the 
> loader
> tries to make a unified model out of both the schemas and needs to be able 
> to
> resolve the location of the second one.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Schema Loading Question

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
>
> Note that there are 2 schemas and they reference each other via import.
>
> So here is my problem.  When I load the schema "a" using XMLSchemaLoader.loadGrammar(XMLInputSource), Xerces tells me that it cannot resolve the types that are defined in schema "b".  Likewise, if I try to load schema "b" first, then Xerces cannot resolve types defined in schema "a".
>

If you havent done it already, you should sent the entityResolver on the
XMLSchemaLoader and then load one of the schemas. This is because the loader
tries to make a unified model out of both the schemas and needs to be able to
resolve the location of the second one.



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org