Real Number Types

XSD defines the following types that are mapped to the C double type:
A double is always used because it provides the maximum precision to hold numbers for all of the types above.
The general mapping is as follows:
XSD type:
<xsd:simpleType name="TypeName">
   <restriction base="xsd:float"/>
Generated C code:
typedef OSREAL TypeName;
Generated C++ code:
class TypeName : public OSRTBaseType {
   OSREAL value;
} ;

The character representation of these numeric types in generated messages can be altered by using a configuration file. This allows behavior such as preservation of leading zeros to be specified.

The <typemap> declarations can be used to map a real number type or a list of real number types separated by space to a string type. This can be done at global or schema level. This mapping configuration can be used to preserve the format of floating point numbers after decoding and reencoding.

For example, to map xsd:double types to string:


For more information, see the XML Numeric Values Format Specification section.

Copyright © Objective Systems 2002-2008
This document may be distributed in any form, electronic or otherwise, provided that it is distributed in its entirety and that the copyright and this notice are included.

Objective Systems, Inc.

55 Dowlin Forge Road
Exton, Pennsylvania 19341
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830