c# - .NET 中所有可能引发的 XmlSchemaExceptions 的列表在哪里?
问题描述
我想在 C# .NET 中使用 XmlReader 为 XmlSchemaExceptions 引发的最常见异常创建一个翻译。还没有在网上找到任何东西,也不想手动生成不同的东西..有人有这个吗?
这是我想检索它可以抛出的所有不同异常的片段:
private void XmlValidation()
{
//XDocument doc = XDocument.Load(xmlFileName);
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add(null, schemaFileName);
notification.Clear();
XmlReaderSettings xrs = new XmlReaderSettings();
xrs.ValidationType = ValidationType.Schema;
xrs.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
xrs.Schemas = schemaSet;
xrs.ValidationEventHandler += (o, s) => {
string warn = s.Severity + ": " + s.Message;
notification.Add(warn);
// Console.WriteLine("{0}: {1}", s.Severity, s.Message);
};
using (XmlReader xr = XmlReader.Create(xdoc.CreateReader(), xrs))
{
while (xr.Read()) { }
}
}
解决方案
推荐阅读
- docker - 由 docker-compose 文件生成的 Kafka 和 Zookeeper 容器中的错误
- elm - 在 git hub 操作中使用 elm-test
- python - python:从ScalarMappable获取整个numpy数组的颜色
- android - 如何在android中解密密码?
- oracle - 使用 PL/SQL 的单选按钮验证
- flask - 使用 @cache.memoize 测试函数会给出 PicklingError
- python - 如何从 ctypes.c_byte 转换或获取确切值
- spring - 如何在测试中的 ApplicationEvent 侦听器之前进行一些设置
- macos - 在 macOS App Store 的崩溃报告中调试 _dispatch_client_callout 中的崩溃
- c# - 单元测试公共签名的 .NET Core/Framework 库