In the Schema-field, clikc the three dots to browse for a schema file. Find the wss.xsd-file, usually located in 'C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML' and click add. That's it, Visual Studio should now give you intellisense. Test this by placing the cursor at the very beginning of the file and press CTRL+Space. You should see a drop-down such as this:
Now, to tell Visual Studio to use the correct xsd-file (wss.xsd) every time you create an onet.xml-file you need to link an xml-namespace to the wss.xsd file. To do this you need to create one more xml file and also remember to use the correct namespace for your onet.xml files.
First, create a new XML-file in C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas. Call it whatever you like, for instance SharePointCatalog.xml. Open the file and paste in the following:
<schemacatalog xmlns="http://schemas.microsoft.com/xsd/catalog">
<Schema
href="C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/XML/wss.xsd"
targetNamespace="http://schemas.microsoft.com/sharepoint/" />
</schemacatalog>
What this actually does is link the 'targetNamespace' with the schema located in 'href'. You can use the same technique to link your own schema to any namespace if you use those.
Now, to get Visula Studio to use the intellisense with the schema, add the namespace attribute to the root elemet of your XML file, for instance:
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://schemas.microsoft.com/sharepoint/">
</project>
If you now hit CTRL+Space you should get intellisense.




0 comments:
Post a Comment