2.2.12.3 Emitting Instruction for the Substitution Rule

BinXml uses templates, as specified in section 3.1.4.7.1. Substitutions are done only inside a template instance definition. Any data needed for substitutions is in the template instance data, which comes immediately after the template instance definition. The template instance definition is defined by the TemplateDef rule in 2.2.12, and the template instance data is defined by the TemplateInstanceData rule in 2.2.12.

To emit a substitution in a template, the tool needs to extract the string value from the instance data section. The tool can use the TemplateDefByteLength (specified in 2.2.12) to locate the template instance data quickly.

One special case is when the substitution is of type BinXml. In that case, the tool MUST use the BinXmlValue rule, which is a recursive call. A typical BinXml document contains a template that contains another template in itself.

The other data types MUST be output as follows.

Type

Output format

NullType

Empty string

StringType

Text

AnsiStringType

Text

Int8Type

Signed integer

UInt8Type

Unsigned integer

Int16Type

Signed integer

UInt16Type

Unsigned integer

Int32Type

Signed integer

UInt32Type

Unsigned integer

Int64Type

Signed integer

UInt64Type

Unsigned integer

Real32Type

Signed value having the form [-]dddd.dddd, where ddd3 is one or more decimal digits.

Real64Type

Signed value having the form [-]dddd.dddd, where ddd3 is one or more decimal digits.

BoolType

"true" or "false"

BinaryType

Each byte is displayed as a hexadecimal number with a single space separating each pair of bytes.

GuidType

GUID. Definitions of the fields are as specified in [MS-DTYP]. The text format is {aaaa-bb-cc-dddddd} where aaaa is the hexadecimal value of Data1; bb is the hexadecimal value of Data2; cc is the hexadecimal value of Data3; and dddddd is the hexadecimal value of Data4. For each of the hexadecimal values, all the digits MUST be shown, even if the value is 0.

SizeTType

Hexadecimal integer. The number portion is preceded by the characters "0x". For example, the number 18 is displayed as 0x12.

FileTimeType

Four-digit year "-", 2-digit month "-", 2-digit day "T", 2-digit hour ":", 2-digit seconds "." and 3-digit milliseconds "Z". For example, 2006-10-20T03:23:54.248Z is 3:23:34 am of October 20, 2006.

SysTimeType

Same as FileTimeType.

SidType

Security ID. A SID type description including the text representation is specified in [MS-DTYP].

HexInt32Type

Hexadecimal integer. The number portion is preceded by the characters "0x". For example, the number 18 is displayed as 0x12.

HexInt64Type

Hexadecimal integer. The number portion is preceded by the characters "0x". For example, the number 18 is displayed as 0x12.