title: How can I add a restriction to a complextype in XML (XSD) schema?
body: <p>Can anyone help me to add a restriction to this schema file (for OwnerEnglishName)? I know how to do it with a simpletype, while in a complextype I don't know how to do it. Can anyone help?</p>
  
  <p>Thanks a lot.</p>
  
  <p>Original XML:</p>
  
  <pre><code>&lt;PACIDemoSignedDoc PaciSDocID="HouseOwnerSignedEndorsement"&gt;  
    &lt;OwnerEnglishName OENID="Name"&gt;&lt;/OwnerEnglishName&gt;
  &lt;/PACIDemoSignedDoc&gt;
  </code></pre>
  
  <p>Schema (without restriction):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="PACIDemoSignedDoc" type="PACIDemoSignedDocType" /&gt;
    &lt;xs:complexType name="PACIDemoSignedDocType"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="OwnerEnglishName" type="OwnerEnglishNameType" /&gt;
      &lt;/xs:sequence&gt;
      &lt;xs:attribute name="PaciSDocID" type="xs:string" /&gt;
    &lt;/xs:complexType&gt;
    &lt;xs:complexType name="OwnerEnglishNameType"&gt;
      &lt;xs:attribute name="OENID" type="xs:string" /&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>The restriction code:</p>
  
  <pre><code>&lt;xs:restriction base="xs:string"&gt;
    &lt;xs:minLength value="5"/&gt;
    &lt;xs:maxLength value="100"/&gt;
  &lt;/xs:restriction&gt;
  </code></pre>