XSD Validation - minLength attribute does not work

Viewed 432

I want to validate one of the required data field which contains a string. data are in a tab delimited file. I have created a simpleType as below,

<xsd:element minOccurs="1" maxOccurs="1" name="Barcode" type="String20"/>

<xsd:simpleType name="String20">
    <xsd:restriction base="xsd:string">
        <xsd:minLength value="1"/>
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>

This validation does not break when the data is empty. I also changed minLength to 2 and tested with one character, but it did not break on that too.

Does any one know how to validate empty string please?

Thanks

0 Answers
Related