Environment: xsd3.2 + Visual Studio 2005
1. Install the xsd-3.2.msi to download from the http://www.codesynthesis.com/products/xsd/download.xhtml. I installed it in: C: \ Program Files \ codesynthesis XSD 3.2. The installation action will add "C: \ Program Files \ codesynthesis XSD 3.2 \ bin" to the path entry of the system environment variable"
2. Add the include directory, lib directory, rule file (. Rules) directory, and executable file directory to Visual Studio.
Select "Tools"> "options"> "projects and Solutions" in the menu bar, and open the "projects and Solutions" window.
The include directory and the lib directory are the parameters used by the program during compilation and linking. The header file in the include directory contains the function declaration, and the. Lib file in the lib directory contains the function definition.
The include directory and lib directory are set at the program level, in the "VC ++ directory ". Select "include file" under "directory showing the following content" to add the include path, and select "library path" to add the lib directory. Here, the include directory and lib directory are: "C: \ Program Files \ codesynthesis XSD 3.2 \ include" and "C: \ Program Files \ codesynthesis XSD 3.2 \ Lib \ vc-8.0"
The rule file specifies the tool used to perform compilation and the parameters used in the compilation process. The default value is cl.exe. Xsd.exe is used here.
In the "rule file search path" column of "VC ++ Project Settings", fill in "C: \ Program Files \ codesynthesis XSD 3.2 \ etc \ vc-8.0"
Directory where the executable file xsd.exe is located:
Under "VC ++ directory", "directory where the following content is displayed", select "executable file" and add a line "C: \ Program Files \ codesynthesis XSD 3.2 \ bin ". Move this line of content to the top line with the up arrow.
The executable file directory allows Visual Studio 2005 to find the XML binding tool xsd.exe. Theoretically, the execution file directory does not need to be set. Because c: \ Program Files \ codesynthesis XSD 3.2 \ bin is added to the system environment variable during. MSI installation, but the system environment variable does not work here. Because Visual Studio 2005 also contains an xsd.exe file in c: \ Program Files \ Microsoft Visual Studio 8 \ SDK \ V2.0 \ bin.
3. Set the rule file rules
Open "C: \ Program Files \ codesynthesis XSD 2005 \ examples \ cxx \ tree \ Hello \ hello-8.0.vcproj" with Visual Studio 3.2 ".
Select "project" and "Custom Rules" in the menu bar ". (This menu is displayed only when you select a project (not a solution or source code file) in the Solution Explorer window .)
In the "Custom Rules" window, select "codesynthesis XSD compiler C ++/tree ing Rules.
In this case, you can view the C ++/tree ing rules item in the "project"> "properties" window in the menu bar.
4. Test the sample code.
Related links:
Using XSD with Microsoft Visual Studio
Http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio