Hi,
I am trying to validate an XML file using the XmlValidatingRe ader and
XmlUrlResolver.
The code for which goes like this:
// Read the XML file.
XmlTextReader xmlReader = new XmlTextReader( _PathToXMLDoc);
XmlValidatingRe ader valReader = new XmlValidatingRe ader(xmlReader) ;
valReader.Valid ationType = ValidationType. Schema;
XmlResolver xRes = new XmlUrlResolver( );
valReader.XmlRe solver = xRes;
valReader.Valid ationEventHandl er += new
ValidationEvent Handler(this.Va lidationCallBac k);
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:schemaLocat ion="20040518 C:\Inetpub\wwwr oot\20040518.xs d">
then the validation suceeds.
But if I were to change the attribute to:
xsi:schemaLocat ion="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?