Calling Validate() on an XmlDocument requires passing in a ValidationEventHandler delegate. That event function gets a ValidationEventArgs parameter which in turn has an Exception property of the type XmlSchemaException. Whew!
My current code looks like this:
ValidationEventHandler onValidationError = delegate(object sender,
ValidationEventArgs args)
{
throw(args.Exception);
}
doc.Validate(onValidationError);
Is there some other method I'm overlooking which simply throws the XmlSchemaException if validation fails (warnings ignored entirely)?