Visualizing the MP Schema

Did you know you can use any edition of Visual Studio to easily visualize and walk through the MP Schema? I got a few complaints when I removed the schema documentation from authormps.com that the diagrams were nice and they were not available in the MSDN schema documentation. This visual documentation was exported from Altova XML Spy which is an awesome XML editing tool but fairly expensive. However there is an equally good way to view the schema using Visual Studio.

First, make sure you have the MP Schema files. You get these when you install the Authoring Console (latest version here). The installation will create a MP Schema directory in your installation folder. In this directory is the ManagementPacklSchema.xsd and other supporting files. Note that if you copy these somewhere else you need all the files in the sub directories as well since the main schema file references this.

Next, ensure you have some version of Visual Studio 2010. If you have an MSDN license you can get a full version from there or you company may be licensed for it. The XML schema explorer ships with all versions except the Express versions. 

Once you have installed Visual Studio, run the program and open the ManagementPackSchema.xsd file. You should get a view as as shown below by default.

image

If you do not see the XML Schema Explorer available on the right then click the link XML Schema Explorer to open it. Locate the <>ManagementPack element in the list under the Empty Namespace, ManagementPackSchema.xsd in the tree view.

image

Drag this onto the design surface and you get an object that is fairly useless and does not look like you can do anything:

image

Now switch to the content model view which is the second tool bar icon from the left:

image

You should now see a workspace column on the left. You need to drag the management pack element onto the surface if it is not already there:

image

Now you can expand the management pack element and drill into each area of the MP in a great visual way. Below is an example of drilling into the ClassType element

image

If you want to jump to the XSD file to explore some more just right click on the element, attribute or type you want and select View Code and you will be taken in context to the correct place in the schema.

Update

Just adding to this post some information about getting the intellisense look up in the schema in Visual Studio when you are editing a Management Pack. When I post this in the comments section the text is getting stripped out so posting it here. Your MP declaration should be the following to point to the MP schema XSD.

<ManagementPack xsi:noNamespaceSchemaLocation="c:\MPSchema\ManagementPackSchema.xsd" xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">

</ManagementPack>