You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Thropp, Shawn" <th...@adlnet.org> on 2003/11/13 16:06:49 UTC

Resolving Relative URI - Xerces J2.5.0

I am seeing something strange when trying to validate XML instance with
Xerces-J 2.5.0.

I have the following structure defined:

vocab/ext_vocab.xsd
lom.xsd
example.xml

Inside of example.xml I have the following declaration:

<lom xmlns = "http://ltsc.ieee.org/xsd/LOM" 
     xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation = "http://ltsc.ieee.org/xsd/LOM lom.xsd
                           http://ltsc.ieee.org/xsd/LOM/custom
ext_vocab.xsd">

This version validates when I use the dom.Writer sample provided by
Xerces-J.  However, I don't think it is correct.
I would think that the declaration in my example.xml should be:

<lom xmlns = "http://ltsc.ieee.org/xsd/LOM" 
     xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation = "http://ltsc.ieee.org/xsd/LOM lom.xsd
                           http://ltsc.ieee.org/xsd/LOM/custom
vocab/ext_vocab.xsd">

Since the ext_vocab.xsd is located in a folder called vocab.  The relative
location from the root to the xsd is vocab/ext_vocab.xsd

However is I change the schemaLocation to the way it is above I get
validation errors:

C:\workarea\XML Parsers\xerces250\xerces-2_5_0>java dom.Writer -v -n -s
test\lomwd2\UniqueStrict_VocabCustom\example1.xml
[Error] custom.xsd:34:65: src-resolve: Cannot resolve the name
'lx:sourceValues' to a(n) 'type definition' component.

and a few others.  

This indicates to me that the parser cannot locate the ext_vocab.xsd.  Is
this a known bug or am I missing something.

Thanks for all the help
Schawn

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


Re: Resolving Relative URI - Xerces J2.5.0

Posted by Michael Glavassevich <mr...@apache.org>.
Hi Shawn,

This has come up on a few occasions [1]. In that last discussion I argued
that relative URIs in the schemaLocation hints are relative to the
resource in which they're actually dereferenced. Now I'm not so sure. You
could argue that they're relative to the document entity or some base URI
you've specified using xml:base. There doesn't seem to be anything in the
spec [2] on how a schema processor should resolve realtive URIs specified
in the schemaLocation hints.

I'm sure someone else on the list could provide more insight.

[1] http://marc.theaimsgroup.com/?l=xerces-j-user&m=105614937202145&w=2
[2] http://www.w3.org/TR/xmlschema-1/#schema-loc

On Thu, 13 Nov 2003, Thropp, Shawn wrote:

> I am seeing something strange when trying to validate XML instance with
> Xerces-J 2.5.0.
>
> I have the following structure defined:
>
> vocab/ext_vocab.xsd
> lom.xsd
> example.xml
>
> Inside of example.xml I have the following declaration:
>
> <lom xmlns = "http://ltsc.ieee.org/xsd/LOM"
>      xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
>      xsi:schemaLocation = "http://ltsc.ieee.org/xsd/LOM lom.xsd
>                            http://ltsc.ieee.org/xsd/LOM/custom
> ext_vocab.xsd">
>
> This version validates when I use the dom.Writer sample provided by
> Xerces-J.  However, I don't think it is correct.
> I would think that the declaration in my example.xml should be:
>
> <lom xmlns = "http://ltsc.ieee.org/xsd/LOM"
>      xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
>      xsi:schemaLocation = "http://ltsc.ieee.org/xsd/LOM lom.xsd
>                            http://ltsc.ieee.org/xsd/LOM/custom
> vocab/ext_vocab.xsd">
>
> Since the ext_vocab.xsd is located in a folder called vocab.  The relative
> location from the root to the xsd is vocab/ext_vocab.xsd
>
> However is I change the schemaLocation to the way it is above I get
> validation errors:
>
> C:\workarea\XML Parsers\xerces250\xerces-2_5_0>java dom.Writer -v -n -s
> test\lomwd2\UniqueStrict_VocabCustom\example1.xml
> [Error] custom.xsd:34:65: src-resolve: Cannot resolve the name
> 'lx:sourceValues' to a(n) 'type definition' component.
>
> and a few others.
>
> This indicates to me that the parser cannot locate the ext_vocab.xsd.  Is
> this a known bug or am I missing something.
>
> Thanks for all the help
> Schawn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

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

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