MinOccurs 0 和 nillable true [英] MinOccurs 0 and nillable true

查看:39
本文介绍了MinOccurs 0 和 nillable true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 wsdl 中有一个元素:

In my wsdl I have an element:

<xsd:element minOccurs="0" name="birthDate" nillable="true" type="xsd:dateTime"/>

我知道 nillable true 允许空值是否意味着它可以允许 xml 空标签?即

I know that the nillable true allows null values does this means that it can allow xml empty tag? i.e

<birthDate/>

推荐答案

设置 nillable="true" 意味着 标签可以如下所示:

Setting nillable="true" means that the <birthDate> tag can appear as follows:

<birthDate xsi:nil="true"/>

但是,由于您还设置了 minOccurs="0",您也可以完全从 XML 中省略 <birthDate> 标记,它仍然会针对您的 XSD.

However, since you also set minOccurs="0", you could also omit the <birthDate> tag completely from the XML and it would also still validate against your XSD.

请注意,根据 XSD 规则, 不被视为 null.

Note that <birthDate/> or <birthDate></birthDate> is not considered null according to XSD rules.

看看 这篇很棒的博文 供进一步阅读.

Have a look at this great blog post for further reading.

这篇关于MinOccurs 0 和 nillable true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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