I am using the Schematron.net nuget package and I want to know if it's possible to get the output of a call to Validate to give the results in a structured format that I can then process. My existing solution relies on a try catch block and the assertion failures are all returned as the message within the exception as the error message. Is there a way to get this information as XML? I have seen this post which asks a similar question, but the answers don't refer to the Schematron.net implementation.
My code looks like this:
try
{
var bookValidator = new Validator();
bookValidator.AddSchema("book.xsd");
bookValidator.Validate("book.xml");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}