Choice tag in FSD

The choice tag defines a sequence of records, choices or other sequences. Unlike sequence, a choice uses pattern matching to pick the best match of the records contained in the choice.

<choice>
		name
		output='yes|no'
		max-occur
		min-occur
				<record/>
				<choice/>
				<sequence/>
</choice>

Attributes

  • name

    Defines the name of the choice. If the output attribute is set to yes this name is used as the XML tag name in the output, and used to match the choice with an XML tag during input.

  • output

    Defines whether the sequence appears in the output or not. The valid values for this attribute are yes and no, where a value of yes means the choice should cause a tag to be generated in the output and no means that the sequence is purely describing the data structure and does not appear in the output.

    The default for this attribute is yes.

  • max-occur

    Defines the maximum number of occurrences for the choice. A value of zero means there can be any number of occurrences.

    The default for this attribute is one.

  • min-occur

    Defines the minimum number of occurrences for the choice.

    The default for this attribute is zero.

Remarks

The choice element looks for the best matching record to process the data. The match is based on attributes such as the valid-value for a field, the record separator and the minimum and maximum occurrences attributes.

The pattern matching for this element imposes a performance overhead and therefore this element should be used with care.