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

7.4 Custom Formatting

The HydraExpress project file allows you to control the way in which a binding formats primitive types. This customization is handled through the mappings element of the HydraExpress project file.

When the binding marshals a primitive type, the marshal function invokes the code specified in the toString element for that type. As described in Section 8.8, the contents of the element appear in the generated binding, with a variable that contains the value to be formatted substituted for the token $value$. The code contained in the toString element must return a standard string.

For example, the project file below includes a mappings element that provides a custom mapping for the XML Schema type xsd:float. The data binding invokes the static function FormatFloat on class FloatFormatterUtils when marshaling a value of type xsd:float.

The mapping includes all of the pertinent information for the type, and completely overrides the existing. In the above example, the toString element specifies the call to the FormatFloat function, and the include attribute of typeinfo identifies the header file for the class that defines the function.

Function FormatFloat uses the standard sprintf to produce a string in a specific format, as shown below:

When using customized mappings, you may wish to create a special HydraExpress project file that specifies only mappings, which you can use as an additional argument to the code generator.

Note that, if you provide more than one HydraExpress project file to the code generator, the values in the last project file override any previously-set values in the event of conflicts. For more information on creating custom HydraExpress project files, see Section 22.2.3, "Creating a Customized Project File for Special Generation Options," in the HydraExpress Web Service Development Guide.



Previous fileTop of DocumentContentsIndex pageNext file

©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.