Wednesday, November 08, 2006

Adding intellisense to your XML files in VS 2005 applied to WSS 3.0

If you are doing SharePoint development, you will seeing a lot of XML files - ONET.XML, SCHEMA.XML, editing these is not a small task so it would be nice if you could add intellisense when editing these files in VS2005. (The next stuff applies to WSS 3.0 but can be used for all types of XML files)

For WSS 3.0 there actually is a schema definition which you can use to add intellisense - it is located underneath c:\program files\common files\microsoft shared\web server extensions\12\templates\xml\wss.xsd

There are 2 ways you can use this file:

  • Right click your open XML file and go to properties Schemas and specify the file over here. This is a lot of work since you will need to do it every time again
  • Add WSS.xsd to the Visual Studio schema cache . The XML editor in VS2005 provides a schema cache underneath %installdir%\xml\schemas. This schema cache is used to include standard XML schemas that are used for Intellisense and XML document validation. To add a new schema, you can easily copy an existing one, rename it and and add in your own association declaration.

<SchemaCatalog xmlns="">
<Schema href="file://C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/XML/wss.xsd" targetNamespace=""/>

So next time your editing one of the SharePoint XML files you should change the xmlns attribute to and VS2005 will automatically give you intellisense.

Thanks for the tip Todd and happy SharePointing everyone ...

tags: , , ,


Oskar said...

For whatever reason this doesn't work for me. What DOES work is ading a folder with links to the schemas in the 12 hive - as shown here

Ivo said...

Doesn't work if your xlmns still has the ows suffix. Remove it and it works!

Thx for your tip!