There are some restrictions between TDS separation types and logical model properties such as group composition and group content validation. The rules governing these options are explained in Restrictions for nesting complex types.
These rules exist to ensure the integrity of the message. A combination of separation type and group composition or group content validation must not lead to a message that is unclear to a TDS parser.
In TDS, Default values are only observed by fixed length elements:
Separation Type | Use of Default values |
---|---|
Tagged Delimited |
Default values are never observed. |
Fixed Length |
Default values are observed on output by all elements. An absent element that has no Default value defined, will cause an error on writing. |
Variable Length Elements Delimited | Default values are only observed by fixed length elements on output. Absent fixed length values must have a Default value available to them. An absent element that has no Default value defined, will cause an error on writing. |
Lists and unions are XML-specific concepts. An element or attribute of a simple type that is a list or a union will cause a task list warning if a TDS physical format is present in the message set. The user can choose whether to make this an error, warning, or information by editing the Validation preferences. If a dictionary is generated from the message set, and an attempt is made to parse a TDS message defined to contain such elements or attributes, a runtime error will occur.
The logical property Repeat reference specifies a field that holds the number of repeats of an object (Element or Group) within a message. The field that holds the number of repeats must be within the message before the object that it refers to.
From a parsing perspective, the Repeat reference property replaces the role of the minOccurs and maxOccurs properties.
If a value for the Repeat reference property is specified for an object, values that are specified for minOccurs and maxOccurs are ignored when parsing and writing. However, values that are specified for minOccurs and maxOccurs are used by logical validation.
When parsing and writing, the exact interpretation of the Repeat reference property depends on the Data Element Separation property of the parent complex type or group as shown in the table below.
Separation type | Interpretation of Repeat reference |
---|---|
Tagged Delimited |
Repeat reference is effectively ignored when parsing and writing. When parsing, the number of occurrences is identified by the tags in the message. When writing, the writer outputs all occurrences in the message tree. |
All Elements Delimited | Repeat reference is
used when parsing and writing, in conjunction with the element’s Repeating
Element Delimiter property, and the parent type’s Suppress
Absent Element Delimiters property. A Repeat reference is allowed only if the parent complex type or group has Suppress Absent Element Delimiters set to Never. All Repeat reference occurrences are expected when parsing, and output when writing. However, parsing accepts elements being absent. Repeat reference = 0 is allowed. No delimiter is expected when parsing, nor output when writing. |
Fixed Length |
Repeat reference is
used when parsing and writing. Repeat reference occurrences
are expected when parsing, and are output when writing, with default values
used for missing elements. Repeat reference = 0 is allowed. |
Variable Length Elements Delimited | For fixed length simple elements, the rules for Fixed Length separation above are followed. For variable length simple elements, all complex elements and groups, the rules for All Elements Delimited that are listed above are followed. |
Data Pattern | Repeat reference is effectively ignored when parsing and writing. When parsing, the pattern is matched as many times as possible. When writing, the writer outputs all occurrences in the message tree. Note that, on parsing, if the data pattern permits a zero length match, and a zero length match occurs, an element is added to the message tree and the matching terminates to prevent an infinite loop. |
The logical properties Min Occurs and Max Occurs specify the permitted number of occurrences of an element or group in a message. They are used when parsing and writing messages, and when validating the content of a message.
When parsing and writing, the exact interpretation of these properties depends on the Data Element Separation property of the parent complex type or group as shown in the table below.
When validating, Min Occurs and Max Occurs are both used to check that the content of the message tree matches the model.
Separation type | Interpretation of Min Occurs and Max Occurs |
---|---|
Tagged Delimited |
Min Occurs and Max Occurs are effectively ignored when parsing
and writing. When parsing, the number of occurrences is identified by the
tags in the message. When writing, the writer outputs all occurrences in the
message tree.
|
All Elements Delimited | Max Occurs only
is used when parsing and writing, in conjunction with the element’s Repeating Element Delimiter property, and
the parent type’s Suppress Absent Element
Delimiters property. A varying number of occurrences (Min Occurs <> Max Occurs) is allowed if Suppress Absent Element Delimiters is set to End of Type.
If Suppress Absent Element Delimiters is Never, then all occurrences are expected when parsing, and output when writing, although parsing will accept elements being absent. Optional occurrence (Min Occurs = 0) is ignored and a delimiter is still expected when parsing, and output when writing. Always absent (Max Occurs = 0) is allowed. No delimiter is expected when parsing, nor output when writing. An unbounded number of occurrences (Max Occurs = -1) is only allowed if the Repeating Element Delimiter is different from the Delimiter. The repeats must be terminated by the delimiter, or a containing group's Group Terminator or Delimiter, or by the end of the message bit stream. On writing, the writer outputs all occurrences in the message tree. |
Fixed Length |
Max Occurs only
is used when parsing and writing. In general, Max
Occurs occurrences are expected when parsing, and Max
Occurs occurrences are output when writing with default values used
for missing elements. A varying number of occurrences (Min Occurs <> Max Occurs) is ignored, Max Occurs is assumed. Optional occurrence (Min Occurs = 0) is ignored, Max Occurs is assumed. Always absent (Max Occurs = 0) is allowed. Fixed Length only. An unbounded number of occurrences (Max Occurs = -1) is allowed if the element or group is the last child in its parent group, and the group is terminated by a Group Terminator or a containing group’s Group Terminator or Delimiter or by the end of the message bit stream. On writing, the writer outputs all occurrences in the message tree, if this number is less than Min Occurs then additional default values are written. |
Variable Length Elements Delimited | For fixed length simple elements, the rules for Fixed Length separation above are followed
with two differences.
For variable length simple elements, all complex elements and groups, the rules for All Elements Delimited above are followed. |
Data Pattern | Min Occurs and Max Occurs are effectively ignored when parsing
and writing. When parsing, the pattern is matched as many times as possible.
When writing, the writer outputs all occurrences in the message tree. Note
that on parsing, if the data pattern permits a zero length match, and a zero
length match occurs, an element is added to the message tree and the matching
terminates to prevent an infinite loop. A varying number of occurrences (Min Occurs <> Max Occurs) is allowed. Optional occurrence (Min Occurs = 0) is allowed. Always absent (Max Occurs = 0) is allowed. An unbounded number of occurrences (Max Occurs = -1) is allowed. |