EncodedCharacterString DataTypes[ITEM_TYPE_MAX]
  Property Description  
    Property Name DataTypes  
    Property Type EncodedCharacterString  
    Accessors None  
    Description Allows you to set the Fast Infoset Encoding for each Xml Data Type.  
    Remarks

DataTypes is an array of EncodedCharacterString structures, each representing an Xml Data Type. The values used to index into the array are defined in the global ItemType enum as follows:

enum ItemType
{
    ItemType_none = 0,
    ItemType_hexBinary,
    ItemType_base64Binary,
    ItemType_i1,
    ItemType_i2,
    ItemType_i4,
    ItemType_i8,
    ItemType_ui1,
    ItemType_ui2,
    ItemType_ui4,
    ItemType_ui8,
    ItemType_r4,
    ItemType_r8,
    ItemType_duration,
    ItemType_yearMonth,
    ItemType_monthDay,
    ItemType_year,
    ItemType_month,
    ItemType_day,
    ItemType_date,
    ItemType_datetime,
    ItemType_time,
    ItemType_char,
    ItemType_string,
    ItemType_boolean,
    ItemType_decimal,
    ItemType_integer,
    ItemType_XmlObjectBase, // not used
    ItemType_XmlCollection, // not used
    ITEM_TYPE_MAX
};

So the EncodedCharacterString structure stored at DataTypes[ItemType_i4] represents the encoding method for all i4 Xml Data Type values within the Fast Infoset document.

EncodedCharacterString is a structure defined as follows:

struct EncodedCharacterString
{
    EncodedCharacterType encodedCharacterType; // EncodedCharacterType_Default has no index
    DWORD dwIndex;
};

Each EncodedCharacterString has an encodedCharacterType and a dwIndex value. The encodedCharacterType is an enum defined as follows:

enum EncodedCharacterType
{
    EncodedCharacterType_Default, //UTF8 or UTF16BE depending on DefaultStringEncoding
    EncodedCharacterType_RestrictedTypes,
    EncodedCharacterType_EncodingAlgorithm,
};

The encodedCharacterType represents the type of encoding to be applied, whilst the index represents which encoding of the selected type to use.

The Default value in EncodedCharacterString for all data types is EncodedCharacterType_Default which uses no encoding, so the dwIndex is not used.

Setting the encodedCharacterType to EncodedCharacterType_RestrictedTypes allows you to set dwIndex to one of the following encoding values:

RESTRICTED_ALPHABET_NUMERIC = 1;
RESTRICTED_ALPHABET_DATE_TIME = 2;

Setting the encodedCharacterType to EncodedCharacterType_EncodingAlgorithm allows you to set dwIndex to one of the following encoding values:

ENCODING_ALGORITHM_HEXADECIMAL = 1;
ENCODING_ALGORITHM_BASE64 = 2;
ENCODING_ALGORITHM_SHORT = 3;
ENCODING_ALGORITHM_INT = 4;
ENCODING_ALGORITHM_LONG = 5;
ENCODING_ALGORITHM_BOOLEAN = 6;
ENCODING_ALGORITHM_FLOAT = 7;
ENCODING_ALGORITHM_DOUBLE = 8;
ENCODING_ALGORITHM_UUID = 9;
ENCODING_ALGORITHM_CDATA = 10;

The SuggestedValues method explains the suggested encoding combinations for each Xml Data Type.

Example: Setting the Fast Infoset Encoding for all i4 Xml Data Types to use the Fast Infoset built in Numeric Restricted Alphabet.

CXmlSerializationContext& context = CXmlSerializationContext::GetDefaultContext();
FastInfosetContext& fiContext = context.GetFIContext();

fiContext.DataTypes[ItemType_i4].encodedCharacterType = EncodedCharacterType_RestrictedTypes;
fiContext.DataTypes[ItemType_i4].dwIndex = RESTRICTED_ALPHABET_NUMERIC;