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 |
| ||||||||||||||||||
| Children | <comment>?, <field>*, <float>*, <if>*, <fragment>*, <pad>*, <peek>*, <record>*, <repeat>*, <prop>*, <setprop>*, <switch>*? = 0 or 1 occurence, * = 0 or more occurences |
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