English 中文(简体)
XDocument。 验证习俗信息
原标题:XDocument.Validate custom validation messages

I m 验证XML使用XDocument的化学物。 有效获取验证信息,如:

The http://www.blablah.co.uk/schemas/cbds:DOB element is invalid - The value 1999-0dsf2-21 is invalid according to its datatype http://www.w3.org/2001/XMLSchema:date - The string 1999-0dsf2-21 is not a valid XsdDateTime value.

这似乎过于方便用户,我很想知道能否以任何方式使这一信息具体化? 如果我能够提供象征性的证明,那是ice的:

The value {0} is invalid for the element {1}

最佳回答

这不是一个完整的解决办法,但这可能有助于你到达你想要的地方。

我认为,这种方法可以采用。 活动Handler 代表。 在你的代表中,如果例外是XmlSchemaValidationException,你可以查阅XML的节点。 如果是的话,你可以使用XmlSchemaValidationException.SourceObject ,收回无效xml node。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签