XML Validator – C# code – catching errors problem

Home Page Forums BizTalk 2004 – BizTalk 2010 XML Validator – C# code – catching errors problem XML Validator – C# code – catching errors problem

#14135

I still need a little help here… I started using the same validation class in a BizTalk 2006 solution. It is still working perfectly, but because the XmlVali######Reader is obsolete in .Net 2.0, I’m getting warnings. I tried modifying the class to use the following code instead of the XmlVali######Reader approach:

[code:1:144a86be14]
// Set up XmlVali######Reader and validate document – OBSOLETE!
//Using XmlReaderSettings instead

XmlReaderSettings settings = new XmlReaderSettings();

settings.ValidationType = ValidationType.Schema;

XmlReader reader = XmlReader.Create(new System.IO.StringReader(businessDocument.OuterXml), settings);
foreach (XmlSchema xschema in btsSchemaCollection.SchemaCollection)
{
settings.Schemas.Add(xschema);
}

settings.ValidationEventHandler += new ValidationEventHandler(reader_ValidationEventHandler);

while (reader.Read()) { }

reader.Close();[/code:1:144a86be14]

However this is not getting my document validated at all (it always validates fine even when it shouldn’t). Any idea on what could I be missing? Thanks again for the help