【发布时间】:2017-04-19 05:49:11
【问题描述】:
我正在使用 Schematron.net nuget 包,我想知道是否有可能获取对 Validate 的调用的输出,以便以结构化格式提供结果,然后我可以对其进行处理。我现有的解决方案依赖于 try catch 块,并且断言失败都作为错误消息作为异常中的消息返回。有没有办法将这些信息作为 XML 获取?我看过这个post,它提出了一个类似的问题,但答案并不涉及 Schematron.net 实现。
我的代码如下所示:
try
{
var bookValidator = new Validator();
bookValidator.AddSchema("book.xsd");
bookValidator.Validate("book.xml");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
【问题讨论】:
标签: c# xml schematron