Cool Visual Studio 2005 Feature: Snippets and Document Inference

I love learning new featuresof Visual Studio.  Today, I saw an email from Chris Lovett where he showed a feature of snippets that I had no idea existed.  Intellisense in an XML document will actually create an XML document inferred from an associated schema.

Start with an XML schema.  Here, I created a simple complex type "TN" and created an element "PhoneNumber" using that type.

Create a new XML document.  In the Properties pane for the document (hit F4 while in the document editor to pull up the properties), associate the document with the schema that you just created. 

Click on the ellipsis button and that will pull up a window that lets you choose from schemas in the project or in the schema cache.

 Once you associate the XML document with your schema, go back to the editor for the XML document. As expected, when you type the first angle bracket, you get an Intellisense dropdown according to the schema. That's not the cool part yet...

The cool part is that you can select the node, then hit "TAB TAB" and it will stub out an XML document based on the schema that you just created with the capability of code snippets-like fill-ins for the values.