rb*******@gmail.com wrote:
The schema is for a custom CMS and each element is sort of a "Page
Part". So the requirement is the following
"Feature-Box" page part can have any order of the following sub page
parts
Sub-Head (Min: 1, Max: unlimited)
Title-Text (Min: 0, Max: unlimited)
Text (Min: 0, Max: unlimited)
Link-List (Min: 0, Max: unlimited)
How would I write the "nested choice loop"?
Thanks in advance for you help!
Ryan
Ok, well if you deal with the Sub-Head element separately by placing
that within a sequence by itself with minOccurs=1 and
maxOccurs=unbounded and then place the other 3 elements within a choice
which has minOccurs = 0 and maxOccurs = unbounded
Something like this:
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name1" type="type1"/>
<xs:element name="name2" type="type2"/>
</xs:choice>
</xs:sequence>
<!-- define complex types -->
<xs:complexType name="type1">
<xs:sequence>
<xs:element ref="Sub_Head" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="type2">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="Title_Text"/>
<xs:element ref="Text"/>
<xs:element ref="Link_List"/>
</xs:choice>
</xs:complexType>
I should say though that that is just off the top of my head and I
haven't checked it or anything cos by computers being a dog at the
moment so I can't guarantee it's even correct!! ;-) I think you're
looking for something along those lines though.
Steve