我有一个xsd代码,如下所示:
<xsd:complexType name="Parent" >
<xsd:sequence>
<xsd:element name="child1" type="tns:TimeWindow" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="child2" type="tns:SlotRange" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
当上述代码转换为xml时,即使minOccurs设置为零,也会向child1添加必填字段。如果没有child1对象,则会导致验证错误。
<structure name="Parent">
<member name="child1" target="_TimeWindowVector"/>
<member name="child2" target="SlotRange"/>
</structure>
<required target="Parent$child1"/>