I need to create an XML schema that looks something like this:
<xs:element name="wrapperElement">
<xs:complexType>
<xs:sequence>
<xs:element type="el1">
<xs:element type="el2">
</xs:sequence>
<xs:WhatGoesHere?>
<xs:element type="el3">
<xs:element type="el4">
<xs:element type="el5">
</xs:WhatGoesHere?>
<xs:sequence>
<xs:element type="el6">
<xs:element type="el7">
</xs:sequence>
</xs:complexType>
</xs:element>
What I need is a replacement for "WhatGoesHere" such that any number of el3, el4 and el5 can appear in any order. For instance it could contain {el3, el3, el5, el3}
Any idea on how to solve this?
You want xs:choice
with occurrence constraints:
<xs:element name="wrapperElement">
<xs:complexType>
<xs:sequence>
<xs:element name="e11"/>
<xs:element name="el2"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="el3"/>
<xs:element name="el4"/>
<xs:element name="el5"/>
</xs:choice>
<xs:element name="el6"/>
<xs:element name="el7"/>
</xs:sequence>
</xs:complexType>
</xs:element>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With