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.
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.
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 | rwsf::TimeSpan1 |
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 |
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 Section 8.7.2.
C++ or SourcePro Type | Initial Value |
RWCString | RWCString() |
std::string | std::string() |
RWDecimalPortable | 0 |
rwsf::TimeSpan | 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) |
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.
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 Section 2.4.2, "Instance Document Validation." For an example of using isValid(), see Section 3.6.3, "Validating the Instance Document."
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.