本文介绍了在Visual Studio(2013)中为"CustomDictionary.xml"定义架构的正确方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用自定义词典( CustomDictionary.xml ),它正在按应有的方式工作.但是,我不断收到警告,向我表明XML文件未正确定义其XSD架构位置:

I'm making use of a custom dictionary (CustomDictionary.xml) for Code Analysis, and it is working like it should. But, I keep getting warnings that indicate to me that the XML file is not defining its XSD schema location properly:

我在计算机上找到了XSD(CustomDictionary.xsd),并且将其URI的方案指定为file类型:

I found the XSD (CustomDictionary.xsd) on my machine, and I specified the scheme of its URI as type file:

file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2012.0/Team%20Tools/Static%20Analysis%20Tools/Schemas/CustomDictionary.xsd

使用此URI,Chrome可以很好地找到XSD文件.也就是说,如何在CustomDictionary.xml中正确引用CustomDictionary.xsd?

With this URI, Chrome is able to locate the XSD file just fine. That said, how do I properly reference CustomDictionary.xsd from within CustomDictionary.xml?

到目前为止,我发现的内容表明以下应该应该起作用,但事实并非如此:

What I have found so far indicates that the following should work, but it is not:

<Dictionary
  xmlns="http://www.w3schools.com"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.w3.org/ file:/.../CustomDictionary.xsd">

(请注意,为清楚起见,我已截断了CustomDictionary.xsd的路径.)

(Note that I have truncated the path to CustomDictionary.xsd for clarity.)

关于我在做什么错的任何建议?

Any suggestions on what I'm doing wrong?

推荐答案

CustomDictionary.xsd添加到您的项目中.然后在XML文件CustomDictionary.xml中,将xmlns:xsixsi:noNamespaceSchemaLocation属性添加到Dictionary元素中,如下所示:

Add CustomDictionary.xsd into your project. And in your XML file, CustomDictionary.xml, add the xmlns:xsi and xsi:noNamespaceSchemaLocation attributes to the Dictionary element as follows:

<Dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="CustomDictionary.xsd">

这篇关于在Visual Studio(2013)中为"CustomDictionary.xml"定义架构的正确方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-24 13:09