473,562 Members | 2,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

correct use of xsi:schemaLocat ion


I have a question about the correct use of the attribute
xsi:schemaLocat ion. 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="nsAnt on"
xmlns:bt="nsBer ta"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="nsBerta antonFile.xsd">
<!-- content -->

The schema definitions files used by example.xml are

<schema targetNamespace ="nsAnton">
<include schemaLocation= "nsAnton.xs d"/>
<import namespace="nsBe rta" schemaLocation= "nsBerta.xs d"/>

<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:schemaLocat ion="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:schemaLocat ion="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:schemaLocat ion, i.e. in

xsi:schemaLocat ion="namespace namespaceFile.x sd"

the condition

namespace == TARGET-NAMESPACE ( namespaceFile.x sd )

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:schemaLocat ion 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:schemaLocat ion.

yours sincerely

Jul 20 '05 #1
0 10709

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 element of XML document does not have "xsi:schemaLocation" attribute, which is used to specify the .xsd file. Is there any other way for specifying the name of .xsd file?
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 to write an XSL stylesheet that makes an exact copy (including the namespace and schema location) of the input document except that it removes the base64 encoding and replaces it with the text...
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 element of XML document does not have "xsi:schemaLocation" attribute, which is used to specify the .xsd file. Is there any other way for specifying the name of .xsd file?
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 schema file to an .XML file. (I'm using xsd.exe to generate my serializable class, XmlSerializer to Serialize and DeSerialize and XMLValidatingReader to validate. My intention is that application...
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 "xsi:schemaLocation" attribute. I am not sure how to add this to the XML element Please help me with if you can. Thanks, kaush
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 = myDoc.CreateXmlDeclaration("1.0", "UTF-8", "yes") Dim newElem As XmlElement = myDoc.CreateElement("sender") newElem.SetAttribute("schemaVersion", "1.0") newElem.SetAttribute("xmlns",...
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 write the class definition which will be serialized to needed XML file. So I descibed all structure of my XML file at class definition unless one thing. In my XML file I have the expression like...
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 contain a xsi:schemaLocation attribute in my root node but I can't figure out any way to do it. Here is what the resulting XML file must look like (small sample): <TXLife...
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 gpx { using System.Xml.Serialization;
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.