Share via


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.

Comments

  • Anonymous
    September 20, 2005
    The XML editor in VS2005 is great - I threw away XML Spy, which is good since it is so slow on larger files.

  • Anonymous
    November 10, 2005
    can you point me in direction to find more information on "Schema Catalog file"

    particularly what are they, how to use them?

    thanks.

    if it helps, i work w/ several developers and it would be nice to automatically have their vwd editions wire up the schemas via this resource,
    &/or perhaps this can be achieved w/ a "Team Settings File"??

  • Anonymous
    November 17, 2005
    Did you look here: https://blogs.msdn.com/stan_kitsis/archive/2005/09/19/471581.aspx

  • Anonymous
    February 01, 2007
    The only problem being that if you use the "Schemas" property of the document, it doesn't get saved with the solution, so other people downloading your code have to set the schema manually on their copy.  I don't see why Microsoft didn't make this more obvious - especially as you have to click inside the document to see this property. I had to use schemaLocation, although I must say I think the help for this on the MSDN site is awful!  I ended up using XML Spy to create the relative XSD relationship for me from my XML Document.  I would have thought this might have been natively available in Visual Studio 2005 but apparently not!

  • Anonymous
    March 25, 2008
    I don't care about how many ways to associate a schema with an XML document, What I need is only one stable way to do this, at least as they are documented in MSDN.