I am having some trouble finding out how to tell the XSD that the data of a field has to have an minimum length of 12 digits and a maximum length of 14 digits. Is there someone who knows how to do this because minlength
and maxlength
can only be used for strings.
<xs:simpleType name="timestamp_vorige_inspectie">
<xs:restriction base="xs:integer">
<xs:minLength value="12"/>
</xs:restriction>
</xs:simpleType>
You can use xs:pattern
to restrict the number of digits to be in your range:
<xs:simpleType name="timestamp_vorige_inspectie">
<xs:restriction base="xs:integer">
<xs:pattern value="\d{12,14}"/>
</xs:restriction>
</xs:simpleType>
\d
is a regular expression construct that matches any digit. {12,14}
specifies the allowed number of the preceding matches.