For programmer it may be required that a value is to be entered to a required length. Thus to verify the length of the entered value in XML Schema Definition Facets are imposed on Length. The XSD code below provides an example to accept the password upto required length.
Code:
<xs:element name="Pwd">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="7"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
The above code will accept password if it is of length 7 characters. Thus facets can be useful for data validation.
Bookmarks