Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I've understood your requirement correctly then you could phrase the model as "one of SubMenu or MenuItem followed by zero or more SubMenu or MenuItem elements". That can be expressed quite easily as a sequence of two choices:</p> <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;!-- whatever your element needs to be modelled as here --&gt; &lt;xs:element name="MenuItem"&gt; &lt;xs:complexType&gt; &lt;xs:attribute name="text"/&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;!-- only modelling the structure of the child elements here --&gt; &lt;xs:element name="SubMenu"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:choice minOccurs="1" maxOccurs="1"&gt; &lt;xs:element ref="MenuItem"/&gt; &lt;xs:element ref="SubMenu"/&gt; &lt;/xs:choice&gt; &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; &lt;xs:element ref="MenuItem"/&gt; &lt;xs:element ref="SubMenu"/&gt; &lt;/xs:choice&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="Menu"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:choice minOccurs="1" maxOccurs="1"&gt; &lt;xs:element ref="MenuItem"/&gt; &lt;xs:element ref="SubMenu"/&gt; &lt;/xs:choice&gt; &lt;xs:choice minOccurs="1" maxOccurs="unbounded"&gt; &lt;xs:element ref="MenuItem"/&gt; &lt;xs:element ref="SubMenu"/&gt; &lt;/xs:choice&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>You could model this more cleanly using a shared global type for Menu and SubMenu but this way is relatively obvious I hope.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload