Is it possible to use inheritance in xsd with variable element order? <p>Is it possible to use inheritance in xsd with variable element order?</p> <p>Basically, something like this does not work, since "all" is not allowed inside "extension":</p> <pre><code>&lt;xs:complexType name="root"&gt; &lt;xs:complexContent&gt; &lt;xs:all&gt; &lt;xs:element name="A" type="xs:string"/&gt; &lt;xs:element name="B" type="xs:string"/&gt; &lt;/xs:all&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="extended"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="root"&gt; &lt;xs:all&gt; &lt;xs:element name="C" type="xs:string"/&gt; &lt;xs:element name="D" type="xs:string"/&gt; &lt;/xs:all&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; </code></pre> <p>The simplest solution would be just to use "sequence" instead of "all", but in my case this is not an option, since the element order is not guaranteed, so something like this:</p> <pre><code>&lt;obj&gt; &lt;B/&gt; &lt;C/&gt; &lt;D/&gt; &lt;A/&gt; &lt;/obj&gt; </code></pre> <p>will be invalid because of the wrong element order, but is should not be since all the elements are present.</p>