I need to validate the following element:-
<xs:element name="IsBucketRequired" type="xs:unsignedInt"/>
Validation required:-
1. Allow 1,0 [Pattern]
2. Allow Empty value.
I try with following code:-
<xs:element name="IsBucketRequired" nillable="true" minOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:unsignedInt">
<xs:pattern value="[1,0]"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Above method validate 1,0 correctly but it's not allow Empty value.
another try for same validation but not working.
<xs:element name="IsBucketRequired">
<xs:simpleType>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="0"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:unsignedInt">
<xs:pattern value="[1,0]"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:element>
Anyone please tell me how to write validation code for my requirement.
Thank you