Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > correct use of xsi:schemaLocation

Reply
Thread Tools

correct use of xsi:schemaLocation

 
 
Sarah Tegtmeier
Guest
Posts: n/a
 
      01-16-2004
Hi

I have a question about the correct use of the attribute
xsi:schemaLocation. My programm has to process XML files where the value of
this attribute causes some problems. The programm is written in C++
using Xerces C++ version 2.3.0. An older older version of the programm
used Xerces C++ version 1.6.0.

The XML files look like the following example:

example.xml
============
<an:root xmlns:an="nsAnton"
xmlns:bt="nsBerta"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="nsBerta antonFile.xsd">
<!-- content -->
</an:root>

The schema definitions files used by example.xml are

antonFile.xsd
==============
<schema targetNamespace="nsAnton">
<include schemaLocation="nsAnton.xsd"/>
<import namespace="nsBerta" schemaLocation="nsBerta.xsd"/>
</schema>

nsAnton.xsd
============
<schema targetNameSpace="nsAnton">
<element name="root">
<!-- content of root-element -->
</element>
</schema>

nsBerta.xsd
============
<schema targetNamespace="nsBerta">
<!-- vocabularry of schema nsBerta -->
</schema>

When I validate file example.xml with a SAX parser using Xerces C++
version 1.6.0 the file is recognized as valid. xmlspy (professional
edition version 5, release 4) also tells me that the file is valid.
But when i run a SAX parser using Xerces C++ verion 2.3.0 i got the
message
"Schema in antonFile.xsd has a different target namespace
from the one specified in the instance document nsBerta."
and the file is considered as invalid.

So i have two validation results one from Xerces C++ 1.6.0 and xmlspy
5.4 and one from Xerces C++ 2.3.0. But which one is correct?
When I change the value of the schema location attribute to

xsi:schemaLocation="nsAnton antonFile.xsd"

the file is considered as valid by all of the three parsers. Hence the
two different validation results of file example.xml are caused by

xsi:schemaLocation="nsBerta antonFile.xsd"

in my opinion the classification of Xerces C++ 2.3.0 is correct
because the target namespace of antonFile.xsd is nsAnton and not
nsBerta. I would expect that the target namepace of the schema
defintion file must match the namespace to which the schema definition
file is connected by the attribute xsi:schemaLocation, i.e. in

xsi:schemaLocation="namespace namespaceFile.xsd"

the condition

namespace == TARGET-NAMESPACE ( namespaceFile.xsd )

must be satisfied.

Is my interpretation correct?

The W3C recommendation (http://www.w3.org/TR/xmlschema-1/) states that
the value of the attribute xsi:schemaLocation gives only a hint where an
application can find the definition of a namespace but an application
must not use this information.

I would appreciate information about the correct use of the attribute
xsi:schemaLocation.

yours sincerely

Sarah
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simulation result is correct but synthesis result is not correct J.Ram VHDL 7 12-03-2008 01:26 PM
Uploaded File Empty but in correct folder with correct name froil Perl Misc 12 03-02-2006 01:21 PM
Correct White Balance Doesn't Mean Correct Color?? jim evans Digital Photography 28 12-27-2005 05:10 AM
correct or not correct? Dan HTML 7 10-02-2003 10:16 PM
To correct my program. please, check to find errors and correct me. joon Java 1 07-08-2003 06:13 AM



Advertisments