The use these elements:
length - the exact length of the lexical value.
minLength - the minimum length of the lexical value.
maxLength - the maximum length of the lexical value.
The maximum must always be bigger than the minimum.
A string with two characters
<xs:simpleType name="code"> <xs:restriction base="xs:integer"> <xs:length value="2"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="name"> <xs:restriction base="xs:string"> <xs:minLength value="2"/> <xs:maxLength value="50"/> </xs:restriction> </xs:simpleType>