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

20.3 Invoking the Generator with an XML Schema

Given the command

the generator creates a project titled MyProject based on the schema MySchema.xsd and places it into a directory MyProject.

Section 20.4.1 illustrates the architecture of the generated classes. Section 20.4.2 describes the generated output.

The generator creates a log file rwsfgen.log, located in the directory where the generator was invoked, listing all generated files. If you run the command again, HydraExpress regenerates only those files that need to be updated due to changes in the schema or generation options.


You should never add business logic or make any other changes to the generated source code as these changes will be lost the next time the code is generated.

HydraExpress creates several subdirectories containing the generated files, as well as a project file reflecting the various options used when generating the project. For more detail on the project file and the code generation directory, see Chapter 21, "The Project File and Directory Structure."

20.3.1 Architecture of the Generated Classes

This section includes a UML diagram of the interfaces and sample applications generated by the schema compiler. (Additional internal and support files not included in the diagram are also generated, but these are for internal use only.)

Figure 12: Architecture of the Datatype Generated Classes

The generator creates a C++ class for each complex type defined in the schema. Each of these classes is based on the handle/body idiom, as illustrated in Figure 12, and each one is derived from the library classes rwsf::XmlBindingHandle and rwsf::XmlBindingBody respectively.

These complex type classes are represented by the handle/body pair <complexType> and <complexType>Imp in the figure above. If the schema defines any top-level elements that are of type <complexType>, an XML binding for that element is created deriving from type <complexType>, shown by the handle/body pair <element name> and <element name>Imp.

The class <schema name>_types_main.cpp is a generated sample application to use the datatype classes. It contains a main() method with sample unmarshaling code.

The two supporting classes, <complextype>Marshal.cpp and <schema name>_typesConverter.cpp, provide marshaling and string conversion functionality, respectively.

For more information on the generated XML bindings, see , "XML Binding Concepts," in the HydraExpress XML Binding Development Guide.

20.3.2 Generated Files

Table 9 shows the output files HydraExpress would produce for the command line

where MyProject is the name of the project and subsequent HydraExpress project file, MyProject is also the code generation directory into which HydraExpress places the generated code, and MySchema.xsd is the schema to compile.

The list below assumes that the schema file contains the complex type definitions TypeA and TypeB, in addition to the element definition, ElementA.


Files that are overwrite-protected will be generated with a ".sample" extension if a file exists in the output directory of the same name. See Section 20.7

Table 9: Generated files for an XML Schema 

DirectoryFilesDescription
MyProject/

MyProject.xml

Project file defining all project elements. See Section 21.3, "The Code Generation Directory."


makefile
makefile_debug

Project-level makefiles. Calls all makefiles in subdirectories. Overwrite protected.


makefile.include

Include makefile. Contains all makefile compiler and linker options. Edits to this file HydraExpress to all makefiles. Overwrite-protected.


MyProject.sln

MSVC 7 or 8 solution files. Generated for Windows platforms, depending on value of -projectversion flag.


deployRelease.bat
deployDebug.bat

Convenience debug and release deployment batch files generated for use with MSVC projects.

    app/
makefile
makefile_debug

Makefiles for app directory. Overwrite protected.

        /data
makefile
makefile_debug

Makefiles for data directory. Overwrite protected.


<MySchema>_main.cpp or
<MySchema>_main.cpp.sample

Sample application file.
Overwrite protected.


<MySchema>_main.vcproj

MSVC 7 or 8 project files generated for Windows platforms.

    bin

Empty directory to contain .exe and .dll files

    codegen/
makefile
makefile_debug

Makefiles for codegen directory. Overwrite protected.

        /data/
makefile
makefile_debug

Makefiles for data directory. Overwrite protected.


[<MySchema>Statics.cpp]

Static element names class, generated when the property -noTopLevelClasses is specified.


<MySchema>Library.vcproj

MSVC 7 or 8 project file generated for Windows platforms.

            /<namespace>
TypeA.cpp  
TypeB.cpp
ElementA.cpp

Source files for the datatype classes sorted into separate namespace directories, if a namespace is specified.


TypeAMarshal.cpp
TypeBMarshal.cpp
ElementAMarshal.cpp

External marshaling classes for each datatype class.

        /etc/
<MySchema>-manifest.xml

Manifest identifying marshalling classes for all generated datatypes.

    docs/
index.html  

HTML documentation files.

    include/

Header files, as follows:

      /<MyProject>
TypeAConverter.h
TypeBConverter.h
ElementAConverter.h

Subdirectories by <projectname>. Also includes conversion utility class header files (to convert the simple types defined in the datamap to and from the underlying string class, string)


[<MySchema>Statics.h]

Static element names class, generated when the property -noTopLevelClasses is specified.

         /<namespace>
TypeA.h 
TypeB.h
ElementA.h ElementAMarshal.h

Header files for the datatype classes sorted into separate namespace directories, if a namespace is specified.

    lib

Empty directory to contain .lib or .so files after the project build.

20.3.2.1 HTML Documentation

To view the HTML API documentation, open the index.html file, using the browser of your choice. For documentation about the non-generated classes on which these generated classes may depend, see the HydraExpress C++ API Reference Guide.

20.3.2.2 Sample Application Files

HydraExpress generates an implemented sample application named MySchema_main.cpp.sample. This file is a simple template from which you can create an application that uses the generated XML binding.

20.3.2.3 C++ Makefiles

To help you build the C++ generated libraries and sample applications, HydraExpress also generates the following versions of makefiles:

A project-level makefile is generated in the code generation directory. This makefile builds the entire project. Makefiles are also generated in the each subdirectory in the event that you wish to build individual directories. For more information on using the generated makefiles, or creating your own, see Chapter 22, "Options for Compiling."

20.3.2.4 MSVC Project Files

For Windows users with Microsoft Visual C++, HydraExpress also generates project and solutions files for MSVC 7 or 8. The files generated depend on the platform you selected when you installed HydraExpress. You can change the default behavior by specifying the
-projectversion flag when you generate the project, as described in Table 11.

20.3.3 Issues with Large Complex Schemas

Large schemas can result in quite long generation times, and may also cause heap overflow in Java. To avoid these problems:



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.