A FieldType describes a binary encoded value that appears in sequence within a StructuredType. Every FieldType shall reference a TypeDescription that describes the encoded value for the field.

A FieldType may specify an array of encoded values.

Fields may be optional and they reference other FieldTypes, which indicate if they are present in any specific instance of the type.

The components of a FieldType are described in Table C.6.

Table C.6 – FieldType components

Name

Type

Description

Documentation

Documentation

An element that contains human readable text and XML that describes the field. This element should capture any semantic information that would help a human to understand what is contained in the field.

Name

xs:string

An attribute that specifies a name for the Field that is unique within the StructuredType.

Other fields in the structured type reference a Field by using this name.

TypeName

xs:QName

An attribute that specifies the TypeDescription that describes the contents of the field. A field may contain zero or more instances of this type depending on the settings for the other attributes and the values in other fields.

Length

xs:unsignedInt

An attribute that indicates the length of the field. This value may be the total number of encoded bytes or it may be the number of instances of the type referenced by the field. The IsLengthInBytes attributes specifies which of these definitions applies.

LengthField

xs:string

An attribute that indicates which other field in the StructuredType specifies the length of the field. The length of the field may be in bytes or it may be the number of instances of the type referenced by the field. The IsLengthInBytes attributes specify which of these definitions applies.

If this attribute refers to a field that is not present in an encoded value, then the default value for the length is 1. This situation could occur if the field referenced is an optional field (see the SwitchField attribute).

The length field shall be a fixed length Base-2 representation of an integer. If the length field is one of the standard signed integer types and the value is a negative integer, then the field is not present in the encoded stream.

The FieldType referenced by this attribute shall precede the field with the StructuredType.

IsLengthInBytes

xs:boolean

An attribute that indicates whether the Length or LengthField attributes specify the length of the field in bytes or in the number of instances of the type referenced by the field.

SwitchField

xs:string

If this attribute is specified, then the field is optional and may not appear in every instance of the encoded value.

This attribute specifies the name of another Field that controls whether this field is present in the encoded value. The field referenced by this attribute shall be an integer value (see the LengthField attribute).

The current value of the switch field is compared to the SwitchValue attribute using the SwitchOperand. If the condition evaluates to true then the field appears in the stream.

If the SwitchValue attribute is not specified, then this field is present if the value of the switch field is non-zero. The SwitchOperand field is ignored if it is present.

If the SwitchOperand attribute is missing, then the field is present if the value of the switch field is equal to the value of the SwitchValue attribute.

The Field referenced by this attribute shall precede the field with the StructuredType.

SwitchValue

xs:unsignedInt

This attribute specifies when the field appears in the encoded value. The value of the field referenced by the SwitchField attribute is compared using the SwitchOperand attribute to this value. The field is present if the expression evaluates to true. The field is not present otherwise.

SwitchOperand

xs:string

This attribute specifies how the value of the switch field should be compared to the switch value attribute. This field is an enumeration with the following values:

Equal

SwitchField is equal to the SwitchValue.

GreaterThan

SwitchField is greater than the SwitchValue.

LessThan

SwitchField is less than the SwitchValue.

GreaterThanOrEqual

SwitchField is greater than or equal to the SwitchValue.

LessThanOrEqual

SwitchField is less than or equal to the SwitchValue.

NotEqual

SwitchField is not equal to the SwitchValue.

In each case the field is present if the expression is true.

Terminator

xs:hexBinary

This attribute indicates that the field contains one or more instances of TypeDescription referenced by this field and that the last value has the binary encoding specified by the value of this attribute.

If this attribute is specified then the TypeDescription referenced by this field shall either have a fixed byte order (i.e. byte order is not significant or explicitly specified) or the containing StructuredType shall explicitly specify the byte order.

Examples:

Field Data TypeTerminatorByte OrderHexadecimal String

Char tab characternot applicable09

WideChartab characterBigEndian0009

WideChartab characterLittleEndian0900

Int16 1 BigEndian0001

Int16 1 LittleEndian0100

anyAttribute

*

Authors of a TypeDictionary may add their own attributes to any FieldType which shall be qualified with a namespace defined by the authors. Applications should not be required to understand these attributes in order to interpret a binary encoded field value.