<repeat> Element Reference

The <repeat> element repeats its children elements a certain number of times. If no attributes are specified, the block will be repeated until there is no more data to consume.

Attributes
NameFormatDescription
maxExpressionSpecifies a maximum number of times the block will be repeated.
minExpressionSpecifies a minimum number of times the block will be repeated.
minlenintThe block will continue to be repeated as long as there are `minlen` bits available.
namestring
numExpressionSpecifies a fixed number of repeats. This is exclusive to all other attributes (except name).
Children<comment>?, <field>*, <float>*, <if>*, <fragment>*, <pad>*, <peek>*, <record>*, <repeat>*, <prop>*, <setprop>*, <switch>*

? = 0 or 1 occurence, * = 0 or more occurences

Detail

The <repeat> element used without any attributes simply repeats its children until no more data is left to be consumed. The following example simply repeats a field until the message is consumed.

    <xddl>
     <structure>
      <repeat>
       <field name="neighbor" length="8"/>
      </repeat>
     </structure>
    </xddl>

    repeat01.xddl

If we don't want to consume the entire message, we have two options. We can specify a max repeat count, or contain the <repeat> within a record:

    <xddl>
    <structure>
      <record length="64">
        <repeat>
         <field name="neighbor" length="8"/>
        </repeat>
      </record>
      <field name="crc" length="32"/>
     </structure>
    </xddl>

    repeat02.xddl