Visual Studio
Creating Advanced XML Help Files

The following example shows how to create a more advanced XML file. The advanced options are not more difficult to use than the basic, required options, but rather are optional items that you can add to your XML files. The steps below illustrate how to create a custom link group called "Custom Help" and adds icons next to the new link group. It also demonstrates how to associate attributes with links.

To create an advanced XML Help file

  1. Create a new XML file.

    You can create it with any text editor or you can use the Visual Studio .NET XML Designer by pressing CTRL+N and then double-clicking XML File.

  2. Add the following XML tags to the file:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- This is an example of an XML file that creates a new link group in the Dynamic Help window and adds links with attributes to it. -->
    <!-- The following is a link to the Dynamic Help schema. -->
    <DynamicHelp xmlns="http://msdn.microsoft.com/vsdata/xsd/vsdh.xsd" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="http://msdn.microsoft.com/vsdata/xsd/vsdh.xsd vsdh.xsd">
       <!-- LinkGroup defines a new topic category where your links can go in the Dynamic Help window. -->
       <LinkGroup ID="CustomHelp" Title="Custom Help" Priority="600">
          <Glyph Expanded="vs:/ctxhelp_opn.gif" Collapsed="vs:/ctxhelp_cls.gif"/>
       </LinkGroup>
       <Context>
          <Keywords>
                <!-- Each KItem contains a keyword you want to use for this topic. This must be a keyword that already exists in Visual Studio. For instance, the following keywords are used to target Solution Explorer and the Code Editor. -->
             <KItem Name="VS.SolutionExplorer"/>
             <KItem Name="VS.TextEditor"/>
          </Keywords>
          <Attributes>
             <!-- AItem contains an attribute you want to use to filter your help links.  For instance, the attribute below causes your custom Help links to show up only in the context of a Visual Basic project. -->
             <AItem Name="Product" Value="VB"/>
          </Attributes>
          <Links>
             <!-- Each LItem contains a link to display when the keyword is in the active context. The "LinkGroup" attribute specifies a custom link group in which to display your topic link. You can reference any of the five default link groups specified in context.xml as well as any new link groups that you define. -->
             <LItem URL="http://msdn.microsoft.com" LinkGroup="CustomHelp">Direct Link to MSDN</LItem>
             <LItem URL="http://localsvr/devsamples/IntroSample.htm" LinkGroup="Samples">Sample: Intro to Visual Studio .NET</LItem>
          </Links>
       </Context>
    </DynamicHelp>
  3. Save the file as "HelpTest2.xml" in Microsoft Visual Studio .NET\Common7\IDE\HTML\XMLLinks\<LCID>, where <LCID> depends upon your language, such as English or French. For example, the English LCID is 1033.
  4. If it is not already open, display the Dynamic Help window by pressing CTRL+F1.

Notice that two new links appear in the Dynamic Help window. One is under a link group called "Samples" and is called "Sample: Intro to Visual Studio .NET" and another link called "Direct Link to MSDN" is under a custom link group called "Custom Help."

Creating custom link groups allows you to have special categories in which to display your links. Professors and other academic instructors might, for example, create a custom link group called "Homework" or "CS101 Projects." They could then put links to their topics under the custom link group. IT managers and group leads might want to create a custom link group, for example, named "Coding Policies" that contains links to Help topics on corporate coding policy. For more information, see Creating Custom Link Groups.

Optional Help XML Tags

In addition to the essential Help XML tags outlined in Creating Basic XML Help Files, you can also add the following optional tags:

  • LinkGroup Tag — Specifies the new link group name in which to display the link. A link group, also known as a "topic category," is a label heading in the Dynamic Help window that organizes the links. The most commonly used link group is "Help," used in the previous example. In addition to the name of the link group, the LinkGroup tag allows you to specify the icons that display for open and closed nodes. Details about this tag can be found in LinkGroup Tag.
  • Attributes/AItem Tags — Sets the scope of the context where the link(s) will be displayed. Details about this tag can be found in Attributes Tag and AItem Tag.

See Also

Adding Custom Links to the Dynamic Help Window | Creating Basic XML Help Files | Creating Custom Link Groups | XML Help Tags

Page view tracker