在 XSD 中将日期类型的最大长度设置为 0 [英] Setting max length of date type as 0 in XSD

查看:33
本文介绍了在 XSD 中将日期类型的最大长度设置为 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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?

推荐答案

您的要求相互矛盾.您不能将一个元素同时限制为日期和为空,因为日期的长度不能为零.

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.

如果您打算允许日期一个空字符串,请参阅允许 XSD 日期元素为空字符串.

If you intend to allow either a date or an empty string, see Allow XSD date element to be empty string.

这篇关于在 XSD 中将日期类型的最大长度设置为 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆