title: How to extend a complex type in a different namespace without changing name
body: <p>I have an existing namespace that I cannot change.  I need to add elements to a complex type such that the resulting XML looks like this:</p>
  <p>Original XML:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
  &lt;Book xmlns=&quot;http://bookshop.com&quot;&gt;
    &lt;Author&gt;Frank Herbert&lt;/Author&gt;
    &lt;Title&gt;Dune&lt;/Title&gt;
  &lt;/Book&gt;
  </code></pre>
  <p>New XML:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
  &lt;Book xmlns=&quot;http://bookshop.com&quot; 
        xlmns:custom=&quot;http://custombookshop.com&quot;&gt;
    &lt;Author&gt;Frank Herbert&lt;/Author&gt;
    &lt;Title&gt;Dune&lt;/Title&gt;
    &lt;custom:Publisher&gt;Ace&lt;/custom:Publisher&gt;
  &lt;/Book&gt;
  </code></pre>
  <p>I have requirements that the custom elements must appear as above with the namespace prefix, and that the complex type name must not change.</p>
  <p>Here is the original XSD and the new XSD I've attempted using redefine.  Will this work, or is there a better way to accomplish this?  Thanks in advance for your advice.</p>
  <p>Original XSD:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; 
             xmlns=&quot;http://bookshop.com&quot; 
             targetNamespace=&quot;bookshop.com&quot;&gt;
    &lt;xs:complexType name=&quot;Book&quot;&gt;
      &lt;xs:complexContent&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element name=&quot;Author&quot; type=&quot;String32&quot; 
                      minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot; /&gt;
          &lt;xs:element name=&quot;Title&quot; type=&quot;String32&quot; 
                      minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot; /&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexContent&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  <p>My attempted new XSD:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; 
             xmlns=&quot;http://custombookshop.com&quot; 
             targetNamespace=&quot;custombookshop.com&quot;&gt;
    &lt;xs:redefine schemaLocation=&quot;http://bookshop.com&quot;&gt;
      &lt;xs:complexType name=&quot;Book&quot;&gt;
        &lt;xs:complexContent&gt;
          &lt;xs:extension base=&quot;Book&quot;&gt;
            &lt;xs:sequence&gt;
              &lt;xs:element name=&quot;Publisher&quot; type=&quot;String32&quot; 
                          minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot; /&gt;
            &lt;/xs:sequence&gt;
          &lt;/xs:extension&gt;
        &lt;/xs:complexContent&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:redefine&gt;
  &lt;/xs:schema&gt;
  </code></pre>