Groups | Blog | Home
all groups > dotnet xml > may 2004 >

dotnet xml : cannot load schema for the namespace


Ian Emery
5/25/2004 4:31:35 PM
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?


Dare Obasanjo [MSFT]
5/26/2004 5:42:25 PM
Can you provide your schema and XML instance so the problem can be tracked
down. It seems unlikely that this is simply due to schema location issues.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]

Ian Emery
5/27/2004 4:00:09 PM
can you give me a valid email address to send the xml to, the zipped file is
12K and too big for the newsgroup :(

[quoted text, click to view]

AddThis Social Bookmark Button