Given the command
<prompt> rwsfgen -projectname MyProject MySchema.xsd
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."
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.)
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.
Table 9 shows the output files HydraExpress would produce for the command line
<prompt> rwsfgen -projectname MyProject MySchema.xsd
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
Directory | Files | Description |
MyProject/ |
MyProject.xml | Project file defining all project elements. See Section 21.3, "The Code Generation Directory." |
|
makefile | 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 | Makefiles for app directory. Overwrite protected. |
/data |
makefile | Makefiles for data directory. Overwrite protected. |
|
<MySchema>_main.cpp or | Sample application file. |
|
<MySchema>_main.vcproj | MSVC 7 or 8 project files generated for Windows platforms. |
bin |
| Empty directory to contain .exe and .dll files |
codegen/ |
makefile | Makefiles for codegen directory. Overwrite protected. |
/data/ |
makefile | 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 | Source files for the datatype classes sorted into separate namespace directories, if a namespace is specified. |
|
TypeAMarshal.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 | 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 | 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. |
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.
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.
To help you build the C++ generated libraries and sample applications, HydraExpress also generates the following versions of makefiles:
a debug version: makefile_debug
a non-debug version: makefile
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."
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.
Large schemas can result in quite long generation times, and may also cause heap overflow in Java. To avoid these problems:
Adjust your settings for the environment variable RW_JAVAOPT, which sends the specified options to Java at each invocation of the code generator By default, the generator sets RW_JAVAOPT to -Xmx512M, which sets the heap size to 512 MB. This heap size is sufficient for most large schemas, although some very large schemas may require an even higher value.
Invoke rwsfgen with the -nohtml option. While the generated documentation is useful for understanding the generated code, its generation adds significantly to the total generation time for complex schemas.
© 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.