problem validating xml against schema


Mike P

I have a web app that has been running happily for months, and on
Saturday it suddenly decided that it no longer wanted to validate my
XML. Here is my code and sample schema, and example XML :

public void ValidateAgainstSchema(object sender, ValidationEventArgs
blnInvalidXML = true;

//in page load :

XmlTextReader tr = new XmlTextReader(new
XmlValidatingReader trv = new XmlValidatingReader(tr);

trv.ValidationType = ValidationType.Schema;

trv.ValidationEventHandler +=
new ValidationEventHandler(this.ValidateAgainstSchema);

while (trv.Read())

if (blnInvalidXML == false)
//do stuff

Schema :

<?xml version="1.0" encoding="iso-8859-1" ?>
<xs:schema xmlns:xs="">
<xs:element name="rsp-vcn">
<xs:element name="auth">
<xs:element name="cug" type="xs:long" />
<xs:element name="pasw" type="xs:string" />
<xs:element name="service">
<xs:element name="countrycode" type="xs:string" minOccurs="1" />
<xs:element name="number" type="xs:string" minOccurs="1" />
<xs:attribute name="type" use="required">
<xs:restriction base="xs:string">
<xs:enumeration value="query" />
<xs:attribute name="message_id" type="xs:byte" use="required" />


<?xml version="1.0" encoding="iso-8859-1" ?>
<rsp-vcn message_id="0"
<service type="query">

I can navigate to the schema in IE, and when I send through XML that the
schema should validate, it doesn't. I am stumped as this code has
worked fine for months.

Can anybody please shed any light on this?



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question