¡°XML2CHM¡± shared software helper
document
NOTE: This shared software will be benefited to the developers who use C# with Microsoft Visual studio .NET.
Updated: Dec 2005
Author: David
Contact: dfliu@163.com
Contents:
2:
Where is the XML file comes from?
3:
How to translate the XML file to CHM(Microsoft help document format)?
In source code files of C#, lines that begin with /// and that precede a user-defined type such as a class, delegate, or interface; a member such as a field, event, property, or method; or a namespace declaration can be processed as comments and placed in a file.
C# provides a mechanism for developers to document their code using XML.
But the XML file can not be read easily, for this reasons, this software will change this XML file to CHM.
2:
Where is the XML file comes from?
The XML file is outputted by compiler of Visual C# .NET environment, the following content will show the steps.
For details, please see MSDN 2003(or 2005) about ¡°XML Documentation Tutorial¡± articles.
Our sample C# solution come from C# testing tool ¡°NUnit 2.2¡±, you can find it at Internet. It contains source code that is written by C# also, and it is free.
The solution name is nunit.sln.
(1) Open the solution (nunit.sln).
(2) In Solution Explorer, right-click the project ¡°nunit.framework.dll¡± and click Properties.
(3) Open the Configuration Properties folder and click Build.
(4) Set the XML Documentation File property to ¡°nunit.framework.xml¡±.
(5) From the Build menu, click Build. The XML output file will be in the debug directory.
(6) The context of ¡°nunit.framework.xml¡±:
As you have seen, it is not easy to read the comment information, so we will translate it to easy reading format. That is CHM file.
3:
How to translate XML file to CHM(Microsoft help document format)?
(1) Launch XML2CHM.exe, the initialize GUI like:
(2) Click the ¡°Browse¡¡± button to locate the document XML file, in our sample it is ¡°nunit.framework.xml¡±.
NOTE:
a. You can select multiple files in the pop-up open file dialog box.
b. You can click the ¡°browse¡¡± button multiple times to select XML files in difference directory.
c. You can click the ¡°Clear¡± button at the right of ¡°File List combo-box¡± to remove the files having selected in the combo-box.
(3) Click the ¡°Read¡¡± button to read the content of XML files to tree list control:
NOTE:
a. You can use the buttons at the bottom of the tree control to operate all the tree items, ¡°Expand or Collapse¡±, ¡°Select or Un-Select¡±
b. You can select or un-select a single item by clicking the check box at the left of it.
c. The selected and its child items will be output to CHM file.
(4) Set your project properties:
Click the button ¡°¡¡± at the right of ¡°Output FileName¡± edit box to set the output CHM file name, in our sample it is set to ¡°NUnit¡±.
Type the project description at the edit box at the bottom of label ¡°Project Description¡±, in our sample it is set to ¡°NUnit Framework Class Library¡±.
(5) After you have selected the items and set the output properties, click the ¡°Trans¡¡± button to translate the XML content to CHM.
If no error occurred then the status message will be ¡°Compile helper project OK!¡± and CHM file will be pop-up auto.
CHM file: