I have xsd schema that define Gender element that accepts only F or M value but I want it also to accept empty <Gender/> element. How to fix following schema?
...
<xs:simpleType name="Gender">
<xs:restriction base="xs:string">
<xs:enumeration value="M" />
<xs:enumeration value="F" />
</xs:restriction>
</xs:simpleType>
...
Have you tried adding:
?
However, this is bad practice. If you want to represent this information in the instance documents, you should omit the
<Gender>element altogether, rather than providing an empty one. Also, it’s unclear what<Gender/>means – does this mean “no gender”, or “unknown gender”? If it’s one of those possibilities, perhaps you should add those to the eneration: