我的 XML 文件
<tns:SampleInfoResponse xsi:schemaLocation="sampleNS test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="sampleNS">
<tns:SampleInfo>
<tns:firstName>String</tns:firstName>
<tns:lastName>String</tns:lastName>
<tns:lbn>String</tns:lbn>
<tns:LSampleDetails>
<tns:SampleState>String</tns:SampleState>
<tns:SampleId>String</tns:SampleId>
<tns:sample>String</tns:sample>
<tns:status>String</tns:status>
<tns:statusDate>String</tns:statusDate>
<tns:SampleId>String</tns:SampleId>
</tns:LSampleDetails>
**<tns:LSampleEnrlDetails/>**
<tns:middleName>String</tns:middleName>
<tns:element1>String</tns:element1>
<tns:element2>String</tns:element2>
</tns:SampleInfo>
</tns:SampleInfoResponse>
我的 XSD 文件
<xsd:schema targetNamespace="sampleNS" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="sampleNS" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:element name="SampleInfoResponse" type="tns:SampleInfoResponseV1"/>
<xsd:complexType name="SampleInfoResponseV1">
<xsd:sequence>
<xsd:element name="SampleInfo" type="tns:SampleInfVO" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SampleInfVO">
<xsd:sequence>
<xsd:element name="firstName" type="xsd:string" nillable="true"/>
<xsd:element name="lastName" type="xsd:string" nillable="true"/>
<xsd:element name="lbn" type="xsd:string" nillable="true"/>
<xsd:element name="LSampleDetails" type="tns:SampleDetailsVO" nillable="true" maxOccurs="unbounded"/>
<xsd:element name="LSampleEnrlDetails" type="tns:SampleEnrlDetailsVO" nillable="true" maxOccurs="unbounded"/>
<xsd:element name="middleName" type="xsd:string" nillable="true"/>
<xsd:element name="element1" type="xsd:string" nillable="true"/>
<xsd:element name="element2" type="xsd:string" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SampleDetailsVO">
<xsd:sequence>
<xsd:element name="SampleState" type="xsd:string" nillable="true"/>
<xsd:element name="SampleId" type="xsd:string" nillable="true"/>
<xsd:element name="sample" type="xsd:string" nillable="true"/>
<xsd:element name="status" type="xsd:string" nillable="true"/>
<xsd:element name="statusDate" type="xsd:string" nillable="true"/>
<xsd:element name="SampleId" type="xsd:string" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SampleEnrlDetailsVO">
<xsd:sequence>
<xsd:element name="element1" type="xsd:string" nillable="true"/>
<xsd:element name="element2" type="xsd:string" nillable="true"/>
<xsd:element name="element3" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
解析器抱怨<tns:LSampleEnrlDetails/>
,XML 文件应该<tns:LSampleEnrlDetails xsi:nil="true"/>
只用于有效文件?通过取出整个标签,解析器也在抱怨。
我想知道<tns:LSampleEnrlDetails/>
当我没有要为标签填充的数据时,此标签的哪些可能情况使 XML 文件根据上述架构有效<tns:LSampleEnrlDetails/>