HydraExpress Components : XML Binding Development Guide : PART III Advanced Topics : Mapping XML Schema to C++ : Complex Types : Content Model Groups : Multiple occurrence or optional all and sequence, multiple occurrence choice
Multiple occurrence or optional all and sequence, multiple occurrence choice
HydraExpress generates an additional class when a sequence or all has a minOccurs of 0 or a maxOccurs greater than 1, or when a choice has a maxOccurs greater than 1. In this case, the name of the new class is formed using the name of the element that contains the group, the type of the group constraint, and the word Type. If more than one group constraint of the same type occurs within the same element, the second class has the number 2 appended to the name. Subsequent groups of the same type increment the number.
For example, given the schema fragment below:
 
<complexType name="BookLocations">
<sequence maxOccurs="unbounded">
<element name="Location" type="string"/>
<element name="InStock" type="int"/>
</sequence>
<attribute name="ISBN" type="string"/>
</complexType>
HydraExpress creates a class named BookLocations and a class named BookLocationsSequenceType. Class BookLocationsSequenceType represents a single occurrence of the sequence in the BookLocations type. BookLocationsSequenceType provides the accessor methods getLocation and getInStock and the mutator methods setLocation and setInStock. Class BookLocations contains a vector of BookLocationsSequenceType objects and provides accessors and mutators for that vector. Class BookLocations typedefs BookLocationsSequenceTypeVector to the actual type of the vector.