Description
See following example schema.
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://sample">
<xs:complexType name="limitedString">
<xs:simpleContent>
<xs:restriction base="ns:rating">
<xs:minLength value="2"/>
<xs:maxLength value="4"/>
<xs:pattern value="([a-d])*" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="rating">
<xs:simpleContent>
<xs:restriction base="ns:anyString">
<xs:minLength value="2"/>
<xs:maxLength value="8"/>
<xs:pattern value="([a-z])*" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="anyString">
<xs:simpleContent>
<xs:extension base="xs:string" />
</xs:simpleContent>
</xs:complexType>
</xs:schema>