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 Xiaofeng Zhang <xi...@actuate.com> on 2008/05/07 03:04:27 UTC

XSLoader can not load XSD which include relative schemaLocation while absolute path works

Hi,

We use XSLoader to load XML schema. If the xsd file include relative
schemaLocation a warning is thrown:

[Warning] :2:46: schema_reference.4: Failed to read schema document
'../base.xsd', because 1) could not find the document; 2) the document
could not be read; 3) the root element of the document is not
<xsd:schema>.

 

Changing to absolute path <xsd:include
schemaLocation="file:///C:/.../base.xsd"/> the XSLoader will work.

Is this a bug?

 

The attached file is a schema example.

 

Regards,

Xiaofeng

 


Re: XSLoader can not load XSD which include relative schemaLocation while absolute path works

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Xiaofeng,

Did you provide a URI when you parsed the document using XSLoader? A common
usage error is specifying an InputStream or Reader and not providing a
system ID as the base URI. Without providing a base URI the schema loader
will fall back to using the current working directory (the value of the
system property user.dir) as the base URI for resolution.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Xiaofeng Zhang" <xi...@actuate.com> wrote on 05/06/2008 09:04:27
PM:

> Hi,
> We use XSLoader to load XML schema. If the xsd file include relative
> schemaLocation a warning is thrown:
> [Warning] :2:46: schema_reference.4: Failed to read schema document
> '../base.xsd', because 1) could not find the document; 2) the
> document could not be read; 3) the root element of the document is
> not <xsd:schema>.
>
> Changing to absolute path <xsd:include
schemaLocation="file:///C:/.../base.xsd
> "/> the XSLoader will work.
> Is this a bug?
>
> The attached file is a schema example.
>
> Regards,
> Xiaofeng
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org