Liquid XML Data Binder 2021
Liquid XML Data Binder (C++, Java, VB6) / Reference / C# and VB .Net (Deprecated - use Liquid XML Objects) / Reference / SerializationContext / FIContext / DataTypes
In This Topic
    DataTypes
    In This Topic
    This feature has been superseded by Liquid XML Objects.
    (The original functionality is still included in the product)
    Use Liquid XML Objects
    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 Conversions.ConversionType
    {
        type_hexBinary = 0,
        type_base64Binary,
        type_i1,
        type_i2,
        type_i4,
        type_i8,
        type_ui1,
        type_ui2,
        type_ui4,
        type_ui8,
        type_r4,
        type_r8,
        type_duration,
        type_yearMonth,
        type_monthDay,
        type_year,
        type_month,
        type_day,
        type_date,
        type_datetime,
        type_time,
        type_char,
        type_string,
        type_boolean,
        type_decimal,
        type_integer,
        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
        int index;
    };

    Each EncodedCharacterString has an encodedCharacterType and a index 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 index is not used.

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

    FastInfosetConsts.RESTRICTED_ALPHABET_NUMERIC = 1;
    FastInfosetConsts.RESTRICTED_ALPHABET_DATE_TIME = 2;

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

    FastInfosetConsts.ENCODING_ALGORITHM_HEXADECIMAL = 1;
    FastInfosetConsts.ENCODING_ALGORITHM_BASE64 = 2;
    FastInfosetConsts.ENCODING_ALGORITHM_SHORT = 3;
    FastInfosetConsts.ENCODING_ALGORITHM_INT = 4;
    FastInfosetConsts.ENCODING_ALGORITHM_LONG = 5;
    FastInfosetConsts.ENCODING_ALGORITHM_BOOLEAN = 6;
    FastInfosetConsts.ENCODING_ALGORITHM_FLOAT = 7;
    FastInfosetConsts.ENCODING_ALGORITHM_DOUBLE = 8;
    FastInfosetConsts.ENCODING_ALGORITHM_UUID = 9;
    FastInfosetConsts.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.

    SerializationContext context = SerializationContext.Default;
    FastInfosetContext fiContext = context.FIContext();

    fiContext.DataTypes[(int)Conversions.ConversionType.type_i4].encodedCharacterType = EncodedCharacterType.EncodedCharacterType_RestrictedTypes;
    fiContext.DataTypes[(int)Conversions.ConversionType.type_i4].index = FastInfosetConsts.RESTRICTED_ALPHABET_NUMERIC;