XML Editor in VS 2005: Did you know?

Did you know that there are multiple ways of associating a schema with an XML document in the XML Editor?  The following list describes all of them in the order in which the XML Editor will look for them

 

  1. Schemas Property on your XML document

  2. Inline inside your XML document

  3. xsi:schemaLocation or xsi:noNamespaceSchemaLocation attributes in your XML document

  4. Open Document Window.

  5. Anywhere in your current Project

  6. In the Schema Cache Directory or from a Schema Catalog file.

This can be useful if you are working with multiple versions of the same schema.  If the XML Editor picks a different schema than the one you want it to use for a particular XML file, then you can always override that choice by editing the Schemas Property on that XML file.

 

Note that if you rename the schema that your XML document is referencing, then the Schemas Property will be automatically updated to point to the new filename. And if you delete the schema that your XML document is referencing, then the Schemas Property will be cleared and the XML Editor will try to find a new schema using locations and order listed above.