Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress XML Binding Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

4.2 Generating Code from Schema

To generate the output for the schema describing the Purchase Order XML document:

  1. Follow the instructions in Chapter 2, "Setup," in the HydraExpress User Guide to set up your environment.

  2. Open a command prompt and navigate to the directory installdir\examples\xmlbinding\namespace.

  3. Invoke the code generator as shown below:

      rwsfgen example-project.xml
      

    The HydraExpress project file example-project.xml provided as an argument specifies the schema po1.xsd, assigns a project name namespaceExample on which the code generation directory is based, and also includes the options to use SourcePro classes and to include whitespace when marshaling.

    This invocation is the same as entering the options and files directly on the command line as follows:

      rwsfgen -projectname namespaceExample -sourcepro -whitespace po1.xsd
      


    SourcePro is not included with HydraExpress. It is a separate product from Rogue Wave Software and must be purchased separately.

For more information on the use of HydraExpress project files in shipped examples, see Section 1.5.1, "The Use of the HydraExpress Project File in Shipped Examples," in the HydraExpress User Guide. For complete information about the command-line options, see Section 20.6, "Generator Options," in the HydraExpress Web Service Development Guide.


The example program in this section uses SourcePro C++ classes. The provided po1_main.cpp file will not compile if you use the -stl binding. The -sourcepro option is specified in the HydraExpress project file example-project.xml used as an argument above. For more information on the HydraExpress project file, see Section 21.3, "The Code Generation Directory," in the HydraExpress Web Service Development Guide.

4.2.1 Generator Output

The classes and other files generated for this example are the same as for the Basic example. For a description of the generated code generation directory structure and specific generated files, see Section 3.3.3, "Generated Files."

Note the generated file po1_main.cpp in the namespaceExample\app\data directory. You can create an application main by editing this file. Replace the TODO items with your application logic. Compile your application as described in Section 4.3.

This example description assumes use of the implemented version of po1_main.cpp located in the installdir\examples\xmlbinding\namespace directory. Before compiling, copy the file po1_main.cpp into the namespaceExample\app\data directory and the file po1.xml into the namespaceExample\bin directory.


Source code other than that in the app directory is not overwrite protected. You should never add business logic or make any other changes to the generated source code as these changes are lost the next time the code is generated.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.