Creating all Groups

Schemas support another type of group: the all group. All the elements in an all group may appear once or not at all, and they may appear in any order. This group must be used at the top level of the content model, and the group's children must be individual elements—that is, this group must itself contain no groups. In addition, any element in this content model can appear no more than once (which means that the allowed values of minOccurs and maxOccurs are 0 and 1 only).

Here's an example. In this case, I'm converting the transactionType type into an all group:

<xsd:complexType name="transactionType"> 
<xsd:all>
					<xsd:element name="Lender" type="address"/>
					<xsd:element name="Borrower" type="address"/>
					<xsd:element ref="note" ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.