A FieldTypedescribes a binary encoded value that appears in sequence within a StructuredType. Every FieldTypeshall reference a TypeDescriptionthat describes the encoded value for the field.

A FieldTypemay specify an array of encoded values.

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

The components of a FieldTypeare 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 aField by using this name.

TypeName

xs:QName

An attribute that specifies the TypeDescriptionthat 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 IsLengthInBytesattributes specifies which of these definitions applies.

LengthField

xs:string

An attribute that indicates which other field in the StructuredTypespecifies 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 IsLengthInBytesattributes 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 SwitchFieldattribute).

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 FieldTypereferenced by this attribute shall precede the field with the StructuredType.

IsLengthInBytes

xs:boolean

An attribute that indicates whether the Lengthor LengthFieldattributes 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 LengthFieldattribute).

The current value of the switch field is compared to the SwitchValueattribute 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 SwitchOperandfield is ignored if it is present.

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

The Fieldreferenced 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 SwitchOperandattribute 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

SwitchFieldis equal to the SwitchValue.

GreaterThan

SwitchFieldis greater than the SwitchValue.

LessThan

SwitchFieldis less than the SwitchValue.

GreaterThanOrEqual

SwitchFieldis greater than or equal to the SwitchValue.

LessThanOrEqual

SwitchFieldis less than or equal to the SwitchValue.

NotEqual

SwitchFieldis 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 TypeDescriptionreferenced 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 TypeDescriptionreferenced by this field shall either have a fixed byte order (i.e. byte order is not significant or explicitly specified) or the containing StructuredTypeshall 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 TypeDictionarymay 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.