XSD:XML验证以允许空字符串
如果我提供一个空值作为XSD:XML验证以允许空字符串,xml,xsd,Xml,Xsd,如果我提供一个空值作为 <xs:element name="SpouseVisionPlanExist" nillable="true" minOccurs="0"> <xs:simpleType> <xs:union memberTypes="EmptyStrings Int"/> &
<xs:element name="SpouseVisionPlanExist" nillable="true" minOccurs="0">
<xs:simpleType>
<xs:union memberTypes="EmptyStrings Int"/>
</xs:simpleType>
</xs:element>
<xs:simpleType name="EmptyStrings">
<xs:restriction base="xs:string">
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Int">
<xs:restriction base="xs:string">
<xs:pattern value="[01]"/>
</xs:restriction>
</xs:simpleType>
我得到一个验证错误。它说,“spoosevisionplanexist”元素无效-值为'
'根据其数据类型“Union”无效-值'
根据联合的任何成员类型,“”无效。“尝试:
nillable用于指定整个标记是否为可选标记。如果我给出,则它工作正常..但同时使用开始标记和结束标记。。对于空字符串,必须实现并集。,
<SpouseVisionPlanExist></SpouseVisionPlanExist>