Validating Xml document, XmlReader reports only one error at a time

Hi,

I've swapped from the deprecated XmlValidatingReader to XmlReader.Create(...)

On validating an Xml document, I now receive one error at a time in my ValidationEventHandler, and no line number, line position information. When I used XmlValidatingReader I could validate an Xml document and get all errors reported in one go with line number and line position info.

How do I get the same behaviour as before

Ken



Answer this question

Validating Xml document, XmlReader reports only one error at a time

  • hazz

    Can you provide code sample how you create reader, your validation callback, XML and XSD files



  • mahdi

    If you don't throw any exception in ValidationEventHandler you should get all validation errors the same way as it was in ValidationReader.

  • dba_sql

    At the ValidationEventHandler's ValidationEventArgs parameter, there is an Exception.LinePosition attribute. Does that help



  • R2ks

    Hi

    I do not throw an exception in the ValidationEventHandler, I collect the e.Message and set a valid flag so that I can report any validation errors, after validation is complete.

    Ken


  • Validating Xml document, XmlReader reports only one error at a time