Reputation: 1668
I have the following code:
<xs:element name="Lang" fixed="de-CH" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:language">
<xs:minLength value="5"/>
<xs:maxLength value="5"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
I would like to ensure that the element Lang
is not empty. If I delete fixed
attribute, the validation for non-emptiness works. Is it a way to do it without removing fixed
?
Upvotes: 1
Views: 937
Reputation: 9585
What about
<xs:element name="Lang">
<xs:simpleType>
<xs:restriction base="xs:language">
<xs:enumeration value="de-CH" />
</xs:restriction>
</xs:simpleType>
</xs:element>
Upvotes: 0
Reputation: 1668
I managed to achieve both fixedness and non-emptyness using xs:pattern
restriction:
<xs:element name="Lang">
<xs:simpleType>
<xs:restriction base="xs:language">
<xs:minLength value="5"/>
<xs:maxLength value="5"/>
<xs:pattern value="de-CH"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Upvotes: 1