While preparing for a presentation on Xml support in Visual Studio and Visual Basic I discovered the new Xml Schema Designer in VS 2010 Beta 2.  The Xml Schema Designer lets you visualize your Xml Schema in a very interesting way that helps you see the structure and content defined by the schema set you are working with.  Let’s explore it a little.

For this article I am using the Linq to NIEM sample I showcased at the NIEM NTE in October.  I have converted the solution to VS 2010 Beta 2 and you can read more about that in this post.

After opening the LEXS 3.1 Schema, the following designer window is what you are greeted with:

image

This window allows you to bring items from your schema set into the schema designer.  The designer reflected over the solution and located all the schema sets which you can see in the details list – 20 Schema documents, 820 Global Elements,  10 Global Attributes, 269 Complex Types, 57 Global Simple Types, 0 Global Model Groups, and 1 Global Attribute Group.

Clicking “add” on Global elements yields a scrollable view of all 820 Global Elements.

image

This is a little hard to work with and fortunately the VS team included some alternate views.  My favorite is the content model view:

image

image

In content model view the elements you’ve added display on the left in the workspace.  On the right is a scrollable region with all the elements and their children displayed individually.  You can drill down further by selecting an element in the workspace and view only that element and it’s child nodes.

image

You can click on the image or image to expand or contract the child nodes allowing you to drill down all the way to the simple types.

If all that visualization wasn’t enough – how about we generate a sample?  Right-click on an Xml node in the designer and make it so!

image

The sample contains data in every element and attribute, probably a bit of over-kill but gives you a nice view of what an instance document will look like.

image

Enjoy!