MinOccurs 0 and nillable true



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

=====================

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

<birthDate xsi:nil="true"/>

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.

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


https://stackoverflow.com/questions/36732264/minoccurs-0-and-nillable-true/36732347
posted @ 2021-08-01 09:32  台风天起飞  阅读(98)  评论(0)    收藏  举报