title: Union of two XML schemas
body: <p>I want a way to find the union of two XML schemas. Is there a standard way of doing it? If not please give your ideas</p>
  
  <p>What I want is like :</p>
  
  <p>Schema1:</p>
  
  <pre><code>&lt;xs:schema&gt;
   &lt;xs:element name="root"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element type="xs:string" name="a"/&gt;
        &lt;xs:element type="xs:string" name="b"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
   &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>Schema2:</p>
  
  <pre><code>&lt;xs:schema&gt;
   &lt;xs:element name="root"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element type="xs:string" name="c"/&gt;
        &lt;xs:element type="xs:string" name="d"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
   &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>The Union would be something like</p>
  
  <pre><code>&lt;xs:schema&gt;
   &lt;xs:element name="root"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element type="xs:string" name="a" minOccurs="0"/&gt;
        &lt;xs:element type="xs:string" name="b" minOccurs="0"/&gt;
        &lt;xs:element type="xs:string" name="c" minOccurs="0"/&gt;
        &lt;xs:element type="xs:string" name="d" minOccurs="0"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
   &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>I do not mind if the union schema validates more XML than the initial two schema, I just want a compact schema which validates all the XML validated by the initial two schema</p>
  
  <p>Please discuss various possible schema unions.</p>