Share via


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>

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    @Michel - Yes you can easily do this.  In your XML declaration just use the following and replace the path below to the schema with where you have it located <ManagementPack xsi:noNamespaceSchemaLocation="C:MPSchemaManagementPackSchema.xsd" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance"> This should give you the intellisense when editing the XML.  Note that earlier versions of Visual Studio had issues with this but current versions seem ok

  • Anonymous
    March 08, 2011
    Hi steve, good post. Any way I could use the XSD in VS as a schema ? So i have validation on my xml MP. When i apply the schema (xml document -> properties -> Schemas: and then select it and select use) it seems not to work i think its because the namespace is incorrect ? It would be great to have the validation working in VS!

  • Anonymous
    March 16, 2011
    @Steve: Tried your solution. But no luck.

  1. Open in VS2010 prof a new XML file
  2. Add the xml tag you supplied on the top.
  3. changed the path to the path where my MP schema files are standing
  4. Try to do < but no type MP element is shown ?? Michel
  • Anonymous
    March 17, 2011
    @Steve: Its working now. ;-) At the MMS 2009 I asked the same question to Vlad and Dan  and it wasn't possible. Till Now (due to VS 2010??) ! Thank you making my MP development process so much easier. Michel

  • Anonymous
    October 20, 2011
    Nice - also remember you can transform the management pack xml to dgml to get diagrams of the class relationships in visual studio. I put a sample transform here: bohdanszymanik.blogspot.com/.../adding-scom-class-properties-to-dgml.html