Stan Kitsis

XML Tools and all things schema in system.xml and MSXML

XML Editor in VS2005: Schema Cache and Schema Catalogs

Below are a few tips and tricks on using schema cache and schema catalogs with the new XML Editor in VS 2005.

Schema Cache

The XML Editor comes with a set of schemas that describe some of the W3C standard and some of the VS specific XML namespaces.  These schemas are installed into your VS installation directory under %vsinstalldir%\xml\schemas.  When you declare one of the namespacess defined by these schemas in your XML files, the XML Editor will automatically associate appropriate schema(s) from the cache location and instantly provide you with intellisense data and validation.  The purpose of the schema cache directory is to hold standard schemas as well as schemas that are unlikely to change.

The following operations are supported by the XML Editor without requiring a VS restart.
- Adding schemas
- Deleting schemas
- Renaming schemas

You can also change the schema cache location.  This is done by modifying Cache Directory Location on Tools | Options | Text Editor | XML | Miscellaneous dialog.  When you do this, the XML Editor will stop using schemas from the old location and instead switch to the new folder.

Schema Catalogs

You can extend existing schema cache using catalog.xml file.  VS installs a sample catalog.xml file (along with catalog.xsd) in the schema cache folder.  This file can be used to do several things.  First of all, you can associate namespaces with external locations as in the following example:

<Schema href="%VsInstallDir%/Common7/IDE/Policy/Schemas/TDLSchema.xsd"

   targetNamespace="http://www.microsoft.com/schema/EnterpriseTemplates/TDLSchema"/>

You can also associate file extensions with specific namespaces.  The following line taken from the sample catalog.xml associates .config files with dotNetConfig.xsd schema

<Association extension="config" schema="%VsInstallDir%/xml/schemas/dotNetConfig.xsd"/>

Finally, you can point your catalog to another catalog file creating a chain:

<Catalog href="http://mycompany/catalog.xml"/>

 

Published Monday, September 19, 2005 6:41 PM by skits
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Richard said:


If this is extended to a web based store (e.g. the set of schemas used for A2A comms in your enterprise) and that store is not terribly responsive (e.g. takes >100ms to respond) would there be any impact on the responsiveness of VS2005's XML editor?
September 20, 2005 4:49 AM
 

skits said:

All the validation is done on a background thread, so there won't be any UI blocking. However, you might not be able to get full validation and intellisense until the XML Editor reads all the schemas.

Stan
September 20, 2005 1:26 PM
 

Ron Cundiff's WebLog said:

Oops. With all of the excitement of doing 2 webcasts in one day yesterday, I forgot to blog the wrap-up

February 14, 2007 5:17 PM
 

Martin Filteau said:

Stan,

How is the catalog being used by Intellisense ?

I'm trying to use URI like "urn:oasis:names:tc:dita:concept.xsd:1.1" as targetNamespace (in the catalog and in the XML document).  However, it seems like intellisense doesn't like prefixes other than file: or http:.

July 17, 2007 12:05 PM
 

Blogs and RSS » Stan Kitsis : XML Editor in VS2005: Schema Cache and Schema Catalogs said:

March 16, 2008 2:51 AM
 

XML-Schema bei VS2005 bekanntmachen | hilpers said:

January 20, 2009 9:10 AM

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker