all groups > dotnet xml > january 2005 >
You're in the

dotnet xml

group:

cannot load schema for the namespace


cannot load schema for the namespace Pet Matrix.
1/6/2005 4:05:05 AM
dotnet xml:
Hi,
I am trying to validate an XML file using the XmlValidatingReader and
XmlUrlResolver.
The code for which goes like this:

// Read the XML file.
XmlTextReader xmlReader = new XmlTextReader( _PathToXMLDoc);

XmlValidatingReader valReader = new XmlValidatingReader(xmlReader);
valReader.ValidationType = ValidationType.Schema;

XmlResolver xRes = new XmlUrlResolver();
valReader.XmlResolver = xRes;


valReader.ValidationEventHandler += new
ValidationEventHandler(this.ValidationCallBack);

while(valReader.Read())
{

}

I have the XML document which refers to a xsd file located on a directory
on the local workstation.
If my XML document has the attribute:
xsi:schemaLocation="20040518 C:\Inetpub\wwwroot\20040518.xsd">
then the validation suceeds.
But if I were to change the attribute to:
xsi:schemaLocation="20040518 <http://localhost/20040518.xsd>";>
I get the error:

"Cannot load schema for the namespace '20040518' - Specified argument was
out of the range of valid values.
Parameter name: The specified value must be greater than 0."

I am able to view the XSD file in IE using the URL
<http://localhost/20040518.xsd,> hence I know that the XSD file is present and
the IIS is configured correctly.

Any ideas as what's causing this error?


Re: cannot load schema for the namespace Martin Honnen
1/6/2005 4:33:40 PM


[quoted text, click to view]


[quoted text, click to view]

Hopefully you have
xsi:schemaLocation="20040518 http://localhost/20040518.xsd">

[quoted text, click to view]

I am not sure from your description what causes this error message, I
would start with using a proper URN for the namespace e.g.
<xs:schema
targetNamespace="http://example.com/2005/ex" ...>

xsi:schemaLocation="http://example.com/2005/ex
http://localhost/20040518.xsd"

but that is a bit guessing.

Are you having problems loading other schemas from localhost as well?
Could you check the schema with MSXML 4 to see whether that also
problems with the schema?

--

Martin Honnen
Re: cannot load schema for the namespace Pet Matrix.
1/9/2005 8:39:03 PM
Hi,
If I run the validator from other machine say mac-2 and my schema's are
stored in mac-1, then the validation will go though.The only change have to
make is the change the schema location in the XML to
"xsi:schemaLocation="20040518 http://mac-1/20040518.xsd".

The mac-1 configuration is windows 2003 server and the IIS version is V6. Is
this causing any problem????

[quoted text, click to view]
AddThis Social Bookmark Button