xml – Visual Studio 2010中的XSD key / keyref intellisense验证支持

我一直在寻找答案而找不到答案:

> Visual Studio 2010中是否通过Intellisense提供XSD密钥/ keyref验证支持?
>如果是这样,如何使它工作?
>如果不是,Visual Studio中是否有(内置)方法在具有XSD架构的XML中进行密钥/引用验证?

谢谢!

更新:请注意,问题不在于如何验证具有XSD文件的XML.我特别询问了关键/ keyref intellisense / Visual Studio中的任何支持,它似乎根本没有添加.

Visual Studio 2012现在支持验证XML文档实例,这些实例受引用模式中定义的key / keyref约束.

但是,当架构文档错误地使用key / keyref时,Visual Studio不会为架构文档本身提供任何错误 – 与某些文档是否符合架构无关.

具体来说,模式中定义的key / keyref元素必须在选择器xpath语句中使用名称空间,根据以下SO帖子:

https://stackoverflow.com/a/4492004/344638

报价:

Furthermore – this is a gotcha – key constraints don’t recognise the default namespace. You must always prefix every part of the selector xpath with the namespace prefix of the element you’re looking up. If you don’t have a namespace prefix – tough,you’ll need to add one. This is a limitation of the standard.

以下SO帖子提供了使用key / keyref,XML文档实例和基于C#的手动验证程序的模式的完整示例.架构和XML文档实例在Visual Studio中正确验证 – 如果文档违反架构的key / keyref约束,Visual Studio将生成错误:

https://stackoverflow.com/a/2866428/344638

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念