问题
<xsd:simpleType name="Date10">
<xsd:restriction base="xsd:date">
<xsd:pattern value="??"/>
</xsd:restriction>
</xsd:simpleType>
The date field shouldn't be able to accept any value in it. I want it to appear like an empty tag. How do I do that?
回答1:
Your requirements contradict each other. You cannot constrain an element to be a date and also to be empty concurrently because dates cannot have zero length.
If you intend to allow either a date or an empty string, see Allow XSD date element to be empty string.
来源:https://stackoverflow.com/questions/47757184/setting-max-length-of-date-type-as-0-in-xsd