472,347 Members | 2,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,347 software developers and data experts.

correct use of xsi:schemaLocation


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:

<an:root xmlns:an="nsAnton"
xsi:schemaLocation="nsBerta antonFile.xsd">
<!-- content -->

The schema definitions files used by example.xml are

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

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

<schema targetNamespace="nsBerta">
<!-- vocabularry of schema nsBerta -->

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
"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

yours sincerely

Jul 20 '05 #1
0 10637

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Naresh Agarwal | last post by:
Hi I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing. I want to perform schema validations on the xml. The problem is that root...
by: John | last post by:
I have an input document that contains a large base64 encoded document. This document also declares a schema location in the root element. I want...
by: Naresh Agarwal | last post by:
Hi I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing. I want to perform schema validations on the xml. The problem is that root...
by: Ron James | last post by:
I'm developing a GUI application in C#. I have a schema file (.XSD) and am able to serialize and deserialize the applications data using the...
by: kaush | last post by:
Hi all, I am trying to serialize a C# object into a XML document using "XmlSerializer" class. One of the elements of the XML document needs a...
by: jean | last post by:
I am creating an xmldatadocument from an acess database with visual basic. Here is the header code I am using: Dim xmldcl As XmlDeclaration =...
by: kolja2003 | last post by:
Hi, I need to program the creation of the XML file of given structure. I try to do it through the serialization of class object. hence I need to...
by: grochmal | last post by:
I am trying to use XmlSerializer to serialize a class I have created specifically for generating an XML file. The problem is that the XML file must...
by: spiceworm | last post by:
Hi all, I'm getting really confused how to solve this. I've got this class generated from XSD with xsd (from visual studio 2005) namespace...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.