XML Binding Development Guide : PART III Advanced Topics : Chapter 8 Mapping XML Schema to C++ : Simple Types
Simple Types
There are 44 built-in XML Schema types. Table 4 illustrates how HydraExpress maps XML Schema types to Standard C++ Library types and SourcePro C++ types.
NOTE >> By default, HydraExpress links to Standard C++ Library types. To link to SourcePro C++ types, use the -sourcepro option when invoking the code generator.
For the SourcePro C++ classes in the table below, please refer to the SourcePro documentation for descriptions.
Table 4 – Mapping of built-in schema types to C++ types 
Built-in XML Schema Type
STL (Standard Template Library) Type
SourcePro C++ Type
string
std::string
RWCString
boolean
bool
bool
decimal
std::string
RWDecimalPortable
float
float
float
double
double
double
duration
std::string
dateTime
std::string
RWDateTime
time
std::string
RWDateTime
date
std::string
RWDate
gYearMonth
std::string
RWCString
gYear
std::string
RWCString
gMonthDay
std::string
RWCString
gDay
std::string
RWCString
gMonth
std::string
RWCString
hexBinary
std::string
RWCString
base64Binary
std::string
RWCString
anyURI
std::string
RWCString
QName
std::string
RWCString
Notation
std::string
RWCString
normalizedString
std::string
RWCString
token
std::string
RWCString
byte
short
short
unsigned byte
unsigned short
unsigned short
integer
std::string
RWDecimalPortable
positiveInteger
std::string
RWDecimalPortable
negativeInteger
std::string
RWDecimalPortable
nonNegativeInteger
std::string
RWDecimalPortable
nonPositiveInteger
std::string
RWDecimalPortable
int
int
int
unsignedInt
unsigned int
unsigned int
long
long
long
unsignedLong
unsigned long
unsigned long
short
short
short
unsignedShort
unsigned short
unsigned short
Name
std::string
RWCString
NCName
std::string
RWCString
language
std::string
RWCString
ID
std::string
RWCString
IDREF
std::string
RWCString
IDREFS
std::string
RWCString
ENTITY
std::string
RWCString
ENTITIES
std::string
RWCString
NMTOKEN
std::string
RWCString

1 For duration, the mapping is to a HydraExpress Library class because there is no good equivalent in SourcePro.

Default Values
HydraExpress initializes built-in schema types to a reasonable value. If the type has a default value associated with it, HydraExpress uses the default value from the schema to initialize the type. Table 5 lists the default value for each of the default C++ types.
The default values for a type can be configured by modifying the configuration file, as described in “Flexible Type Mapping” .
Table 5 – Initialization values for C++ types 
C++ or SourcePro Type
Initial Value
RWCString
RWCString()
std::string
std::string()
RWDecimalPortable
0
All time values set to 0
bool
false
float
0.0
double
0.0
int
0
long
0
short
0
unsigned int
0
unsigned long
0
unsigned short
0
RWDate
RWDate::now() (which is the current date and time)
RWDateTime
RWDateTime::now() (which is the current date and time)
anyType and anySimpleType
An element or attribute that does not specify a type defaults to type anyType. You can also explicitly specify that an attribute or element is of type anyType. By default, HydraExpress maps an anyType to a C++ string type. Because the element is a type with unknown contents and structure, HydraExpress cannot create a fixed binding for the element. Therefore, HydraExpress makes no attempt to parse the contents of an element of type anyType. Instead, HydraExpress returns the contents of this element verbatim as an instance of the type mapped to xsd:string, typically std::string or RWCString.
The type anySimpleType is comparable to anyType, except for the following:
it is always explicitly specified
the permissible values for an element of anySimpleType is the union of permissible values for all built-in types
Like for anyType, HydraExpress creates a member as an instance of the type mapped to xsd:string, typically std::string or RWCString, and makes no attempt to parse the contents of the element.
Validation of simpleType Data
HydraExpress provides an isValid() method in each generated class for checking that the data in elements with a restricted simpleType conforms to the restrictions. For information on this method, see “Instance Document Validation.” For an example of using isValid(), see “Validating the Instance Document.”