问题描述
我正在使用自定义词典( 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:xsi
和xsi: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"定义架构的正确方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!