I have following XSD element:
<xsd:element name="password">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<!-- Length check -->
<xsd:pattern value=".{9,12}" />
<!-- Format check -->
<xsd:pattern value=".*\d{2,}.*" />
<xsd:pattern value=".*[A-Z]{1,}.*" />
<xsd:pattern value=".*[a-z]{1,}.*" />
<xsd:pattern value=".*\p{Punct}.*" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
I want to apply each of those patterns individually. It should first check that length is proper. If so then check that it has at least 2 digits and so on. Instead, it concatenates all the expressions together and tries to apply them together.
This is very poor design. If only one pattern is allowed <xsd:restriction> should define the cardinality of <xsd:pattern> to be 1. Allowing multiple <xsd:pattern> gives the impression that multiple patterns are supported.
Is there a way to apply multiple patterns to a XSD element?
No comments:
Post a Comment