Repeating groups are specified in XML schema definitions using the minOccurs and maxOccurs facets on sequence or choice definitions. These items are converted to ASN.1 SEQUENCE OF types.
An example of a repeating group is as follows:
<xsd:complexType name="Names"> <xsd:sequence maxOccurs="unbounded"> <xsd:element name="givenName" type="xsd:string "/> <xsd:element name="initial" type="xsd:string"/> <xsd:element name="familyName" type="xsd:string"/> </xsd:sequence> </xsd:complexType>
in this case, ASN1C pulls the group out to form a type of form <name>-element where <name> would be replaced with the complex type name. In this case, the name would be Names-element. A SEQUENCE OF type is then formed based on this newly formed type (SEQUENCE OF Names-element). The generated C code corresponding to this is as follows:
typedef struct EXTERN Names_element { const OSUTF8CHAR* givenName; const OSUTF8CHAR* initial; const OSUTF8CHAR* familyName; } Names_element; /* List of Names_element */ typedef OSRTDList Names;
This generated code is not identical to the code generated by performing an X.694 translation to ASN.1 and compiling the resulting specification with ASN1C; it is much simpler. The generated encoder and decoder make the necessary adjustments to ensure that the encodings are the same regardless of the process used.