Chapter 4. XSD Simple Type to C/C++ Type Mappings

Table of Contents

Character String Types
Enumerated Type
Integer Types
Real Number Types
Binary String Types
Date/Time Types
Boolean Type
Union Type
List Type

XSD built-in simple type declarations are mapped directly to C types defined in the osSysTypes.h runtime header file. The general mapping of each XSD simple type to a C type is as follows:

XSD Built-In Type C Type (in osSysTypes) C Type (base)
anyURI OSXMLSTRING unsigned char*
anyType OSXSDAnyType struct
base64Binary OSDynOctStr struct
boolean OSBOOL unsigned char*
byte OSINT8 char
date OSXMLSTRING unsigned char*
dateTime OSXMLSTRING unsigned char*
decimal OSREAL double
double OSREAL double
duration OSXMLSTRING unsigned char*
ENTITIES OSRTDList linked list struct
ENTITY OSXMLSTRING unsigned char*
float OSREAL double
gDay OSXMLSTRING unsigned char*
gMonth OSXMLSTRING unsigned char*
gMonthDay OSXMLSTRING unsigned char*
gYear OSXMLSTRING unsigned char*
gYearMonth OSXMLSTRING unsigned char*
hexBinary OSDynOctStr struct
ID OSXMLSTRING unsigned char*
IDREF OSXMLSTRING unsigned char*
IDREFS OSRTDList linked list struct
integer OSINT32 int
int OSINT32 int
language OSXMLSTRING unsigned char*
long OSINT64 long long (64-bit integer type)
Name OSXMLSTRING unsigned char*
NCName OSXMLSTRING unsigned char*
negativeInteger OSINT32 int
NMTOKEN OSXMLSTRING unsigned char*
NMTOKENS OSRTDList linked list struct
nonNegativeInteger OSUINT32 unsigned int
nonPositiveInteger OSUINT32 int
normalizedString OSXMLSTRING unsigned char*
positiveInteger OSUINT32 unsigned int
short OSUINT16 short
string OSXMLSTRING unsigned char*
time OSXMLSTRING unsigned char*
token OSXMLSTRING unsigned char*
unsignedByte OSUINT8 unsigned char*
unsignedShort OSUINT16 unsigned short
unsignedInt OSUINT32 unsigned int
unsignedLong OSUINT64 unsigned long (64-bit)

For C++, class wrappers are added around each of these types when they are used in simple type declarations. In most cases, these classes contain a single public member variable called value that holds the value of the type. They also contain a constructor and assignment operator for setting the value.

The following sections provide more detail on these mappings.