View XHTML source for local VS Help topics

So you’ve decided to create some local content and you want to use the Visual Studio branding package to simplify your life. It would be helpful to look at Visual Studio source content so you can learn by example. What’s the easiest way to examine Visual Studio local Help topics in raw XHTML?

Let me give you a hint: it’s not right-clicking on a topic in the Help Viewer and “viewing source.” Nor is it cracking open the MSHC files in your local Help Library store. (Although that’s the best approach if you lack access to the Internet.)

As you’d expect, Visual Studio local Help content is just a repackaged version of online MSDN content. Local content is created by running online content through an XSLT transform and then packaging it for distribution. Local help is delivered and updated via the MTPS Service API, a public REST API that exposes MSDN and TechNet Library content. You can use the Service API to find and view raw XHTML files.

Step 1: Determine the ID of the topic you wish to inspect

Locate an online MSDN topic with formatting or behavior you’d like to adopt. The ID of the topic is simply the last segment of the URL and takes one of two forms, a Short ID or an Alias.

Step 2: Use the MTPS Service API to view the topic XHTML

Now that you have an ID, you can use the Service API to view the topic in its original, raw XHTML.

  1. Append the ID to the Service API Content URL and open in a browser. The full URL takes the following form (where TopicID can be an Alias or a Short ID):

    http://services.mtps.microsoft.com/ServiceAPI/content/TopicID

  2. When you provide a valid ID to the content service, you’ll see a list of Locale/Version combinations. Click on the link for your preferred Locale and Version. (See the MSDN URL Cheat Sheet for more information.)

    To view the EN-US version of the XmlReader Class for .NET Framework Version 4: http://services.mtps.microsoft.com/ServiceAPI/content/b8a5e1s5/en-us;vs.100

  3. The page that appears provides a variety of information about your selected topic. Click on the Format:Mtps.Offline link under the Primary Documents heading:

    rawxhtmlsm

  4. Right-click and “View source” to inspect the raw XHTML used by the local help system!

Disclaimer

The information in this post is for educational purposes. Both the MTPS Service API and the Help Viewer branding package are intended for use by the Microsoft Help Viewer and are subject to change.

Learn More

MTPS Service API provides a set of web services for exposing the content in MTPS. The URL for Service API is: http://services.mtps.microsoft.com/ServiceAPI

The Service API is documented at: http://services.mtps.microsoft.com/ServiceAPI/docs/

This entry was posted in Microsoft Help Viewer, Visual Studio 2010 and tagged , , . Bookmark the permalink. Both comments and trackbacks are currently closed.
%d bloggers like this: