Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper way to define the schema for 'CustomDictionary.xml' in Visual Studio (2013)?

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:

CustomDictionary.xml warnings

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

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">

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

Any suggestions on what I'm doing wrong?

like image 990
Eric Avatar asked Oct 29 '14 18:10

Eric


1 Answers

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">
like image 171
cilerler Avatar answered Oct 04 '22 14:10

cilerler