The translation of XSD simple types into ASN.1 types is straightforward; in most cases, a one-to-one mapping from XSD simple type to ASN.1 primitive type exists. The following table summarizes these mappings:
XSD Simple Type | ASN.1 Type |
---|---|
anyURI | UTF8String |
base64Binary | OCTET STRING |
boolean | BOOLEAN |
byte | INTEGER (-128..127) |
date | UTF8String |
datetime | UTF8String |
decimal | UTF8String |
double | REAL |
duration | UTF8String |
ENTITIES | SEQUENCE OF UTF8String |
ENTITY | UTF8String |
float | REAL |
gDay | UTF8String |
gMonth | UTF8String |
gMonthDay | UTF8String |
gYear | UTF8String |
gYearMonth | UTF8String |
hexBinary | OCTET STRING |
ID | UTF8String |
IDREF | UTF8String |
IDREFS | SEQUENCE OF UTF8String |
integer | INTEGER |
int | INTEGER (-2147483648..2147483647) |
language | UTF8String |
long | INTEGER (-9223372036854775808..9223372036854775807) |
Name | UTF8String |
NCName | UTF8String |
negativeInteger | INTEGER (MIN..-1) |
NMTOKEN | UTF8String |
NMTOKENS | SEQUENCE OF UTF8String |
nonNegativeInteger | INTEGER (0..MAX) |
nonPositiveInteger | INTEGER (MIN..0) |
normalizedString | UTF8String |
positiveInteger | INTEGER (1..MAX) |
short | INTEGER (-32768..32767) |
string | UTF8String |
time | UTF8String |
token | UTF8String |
unsignedByte | INTEGER (0..255) |
unsignedShort | INTEGER (0..65535) |
unsignedInt | INTEGER (0..4294967295) |
unsignedLong | INTEGER (0..18446744073709551615) |
The C/C++ mappings for these types can be found in the section above on ASN.1 type mappings.