title: XSD Restriction on local complexType elements
body: <p>I have a schema that has a local complexType element as follows.</p>
  
  <pre><code>&lt;xs:complexType name="AddressType"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="Line1" type="xs:string" minOccurs="0"/&gt; 
          &lt;xs:element name="Line2" type="xs:string" minOccurs="0" maxOccurs="100"/&gt;
          &lt;xs:element name="Location" minOccurs="0" maxOccurs="100"&gt;
              &lt;xs:complexType&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element name="XCoordinate" type="xs:decimal" minOccurs="0"/&gt;
                      &lt;xs:element name="YCoordinate" type="xs:decimal" minOccurs="0"/&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
          &lt;/xs:element&gt;
      &lt;/xs:sequence&gt; 
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I am trying to extend this complexType as follows</p>
  
  <pre><code>&lt;xs:complexType name="InternalAddressType"&gt;
      &lt;xs:complexContent&gt;
          &lt;xs:restriction base="AddressType"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="Location" &gt;
                  &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:complexContent&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I am getting the following error </p>
  
  <pre><code>**Error for type 'InternalAddressType'.  The particle of the type is not a valid restriction of the particle of the base.
  </code></pre>
  
  <p>Can anyone please help me understand what am I doing worng. It seems that the problem is that the Location is a local ComplexType. But I can not change that since I am getting the xsd from the client and need to extend just the Loaction. How can I solve this situation. Any other suggestions are welcome.</p>