While this proved quite helpful, I felt a deep need of intellisense in VS.NET for my objects and hense decided to implement the same.
After a bit of googling and researching, I could find a possible way of implementing the same.
Here's how it goes.
As we all know, VS 2005 implements Intellisense using the XSD files. So the idea was to provide VS IDE with my own XSD so that it could use that XSD instead of the default one.
The process involved the following steps:
1. Create your custom XSD:
2. Make this XSD available to VS.NET IDE
3. Using the custom XSD
1. Create your custom XSD:
Since I was creating intellisense for HTML, I always required the default HTML intellisense and a few of my own. So I decided to use the XSD that VS IDE uses to provide intellisense in HTML view. Those XSDs could be found located at
Apart from these, there are a couple more changes that are required so that the IDE distinguishes between the two schemas.
<xsd:schema version="1.0" targetNamespace='http://schemas.microsoft.com/intellisense/MyCustomSchema'
xmlns='http://schemas.microsoft.com/intellisense/MyCustomSchema'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:vs='http://schemas.microsoft.com/Visual-Studio-Intellisense'
vs:clientom="ie6_0dom.tlb"
vs:ishtmlschema="true"
vs:isserverschema="false"
vs:htmlflavor="4.0"
vs:MultipleScriptLanguages="true"
vs:cssschema="CSS 2.1"
vs:SuccinctFriendlyName="My Custom Schema">
SO now we are all done with the changes. We have a well made XSD to use with our IDE.
2. Make this XSD available to VS.NET IDE
In order to make this XSD available to VS IDE, we need to perform two steps.
- Firstly copy the XSD file to the location where the default XSDs for IDE are located.
- Secondly make a registry entry to register this schema with the IDE. For this, create a .reg file with the following text:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\{1B437D20-F8FE-11D2-A6AE-00104BCC7269}\Schemas\Schema 21]
"Friendly Name"="My Custom Schema"
"URI"="http://schemas.microsoft.com/intellisense/MyCustomSchema"
"File"="html\\MyCustom.xsd"
Running this script would add the information to the Registry and would register the schema to the VS.NET IDE.
One thing to note here is that I have hardcoded the name SCHEMA21. This was because on my machine, I had 20 Schemas already loaded. By default, VS.NET creats 20 schemas and hense we need to maintain the order to get the schema working. Hense the number.
3. Using the custom XSD
Once we close the IDE and reopen it, now this Schema would always be available to the IDE. For using this, goto the IDE, open the HTML designer and you would see a dropdown on the toolbar of the IDE for selecting TARGET SCHEMA FOR VALIDATION
In the dropdown we will find our custom schema listed and by selecting that schema, we could now have intellisense from our own XSD file
I would thank Mikhail Arkhipov for the help he provided
Hi Ashutosh,
ReplyDeleteThat was a very informative and well-written article. Although not because of requirement but because of sheer interest I experimented this.
Also, I think somewhere the text requires few modifications:
1. While mentioning the registry info. for *.reg file, please mention that you need to put 'Windows Registry Editor Version 5.00' in Win XP(I think this line is OS dependent). That could save developer's time.
2. Please specify the toolbar name(Formatting toolbar in your case) in which the user can select the dropdown option for selecting his custom XSD file.
Good Work.
-Kapil Mishra
Thanks kapil.
ReplyDeleteBeing a newly grown up blogger I am bound to make some mistakes but am sure with the constant feedback from you guys (Yes I know and would let the whole world know that you are gr8 at writing articles), I would definitely improve upon it.
Thanks
Hi,
ReplyDeleteI want to implement my own IDE same as our VS Editor.
Do you have some idea or good references related to it?
Thanks in advance.
Regards,
Ashlesh Patel