且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从XmlValidatingReader的ValidationEventHandler中的XmlSchemaException获取节点名称和值?

更新时间:2023-02-04 13:12:53

异常包含消息中的特定节点值. args.Message和args.Exception.Message都仅包含节点名称,这不够有用.我已经探究了发送方和args的所有属性和方法,但没有找到.

这是当前可用消息的示例...

"http://www.sec.gov/edgar/nmfpsecurities:InvestmentIssuer"元素根据其数据类型具有无效值."

这是
exception contains the specific node value in the message. The args.Message and args.Exception.Message both contain only the node name, which is not helpful enough. I have explored all the properties and methods of the sender and args, but have not found it.

Here is an example of the message currently available...

"The ''http://www.sec.gov/edgar/nmfpsecurities:InvestmentIssuer'' element has an invalid value according to its data type."

Here is an example of the message in


例外中的消息示例...

根据其模式类型"http://www.sec.gov/edgar/invest:InvestmentIssuer"-换行(#xA),"EI DU PONT DE NEMOURS& CO."值无效或".xs:token"中不允许使用制表符(#x9)或制表符(#x9),前导或尾随空格以及一个或多个空格序列(#x20)."

我需要知道如何1)在给定发送者和参数的情况下访问失败的节点值,或2)在事件处理程序中神奇地访问内部变量
exception...

"The value ''E.I. DU PONT DE NEMOURS & CO. '' is invalid according to its schema type ''http://www.sec.gov/edgar/invest:InvestmentIssuer'' - line-feed (#xA) or tab (#x9) characters, leading or trailing spaces and sequences of one or more spaces (#x20) are not allowed in ''xs:token''."

I need to know how to either 1) access the failing node value given the sender and args, or 2) magically access the internal variable


异常.谢谢!