How to add nodes for additional content in the TOC in SandCastle?

Topics: User Forum
Jun 27, 2008 at 11:49 AM
Hi!

I have an XML-file with the following structure:

<DocumentExamples> 
   <Example1> 
      <code> 
        // Some code 
      </code> 
   </Example1> 
 
   <Example2> 
      <code> 
        // Some other code 
      </code> 
   </Example2> 
</DocumentExamples> 

I would like to add this XML-file to my helpfile, using Sandcastle Help File Builder. I would prefer to have a node for each example, and to have DocumentExamples as the top node, to make it easy to browse the examples.

Is this possible? If so, how do I do it?

Thank you for your help!

// Emil
Coordinator
Jun 27, 2008 at 4:22 PM
You'll need to create one or more additional content pages or preferably conceptual content pages that contain the information you want.  You could use the conceptual content code snippets feature to import the code samples into conceptual topics but you'd have to change the format of your XML file to match the expected code snippet file format.  The SHFB help file contains some information on that and you can also download a more detailed MAML guide from the Sandcastle Styles site.  Another option is to just use the code block component's ability to import working code from actual source code files so that you don't have to manage an XML file as well as test code to validate that it builds.

Eric
Jun 30, 2008 at 11:51 AM
Eric,

Thank you for your help! I did not know about the Code Block Component, but it worked great! No need for the XML-file anymore!

Is it possible to create a tree, so one can browse the examples in some way, instead of having all examples on one page?
For the moment I can create one file for each example and use the <code> tag to include the code into the page, and then add each file as Additional Content in Sandcastle Help File Builder. Is there some way to create one top node with several child nodes from just one file?

Thank you for your help!

// Emil
Coordinator
Jun 30, 2008 at 4:08 PM
Using MAML, you could probably organize them into sections using <section> elements and, within them, <sections> elements to create sub-sections.  At the top in the <introduction> element, you could add the <autoOutline/> element to have it create a section outline.  It wouldn't be at tree but you'd have an outline of the examples.  Each sub-section could also contain an <autoOutline> element to outline the examples within the sub-section.  See the MAML guide for details.

Eric
Jul 2, 2008 at 12:34 PM
Thank you for your help!

I solved it by writing a small script that will parse my .cs-file and create a .sitemap and .topic-files for me.