views:

532

answers:

1

I am parsing XML with an XMLReader using a XMLReaderSettings object with the event handling setup to carry out schema validation where appropriate.

However it seems that the error catching only occurs once per level of XML. This means that any subsequent errors at that level are ignored.

Is there any way I can get the Error handling event to fire every time an error occurs.

EDIT: I have also tried XmlSchemaValidator but this was unsuccessful. Only caught the first error within the body of a tag.

A: 

This is not easy for a validator to do: after an error occurred, it doesn't know the context so it cannot validate subsequent nodes. Check out this answer: http://stackoverflow.com/questions/476364/validating-xml-tag-by-tag/493095#493095

Teun D