我有以下XSD模板:
<xsd:choice>
<xsd:element name="NilReport" type="ftc:CorrectableNilReport_Type">
<xsd:annotation>
<xsd:documentation xml:lang="en">Nil Report indicates that financial institution does not have accounts to report</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:sequence >
<xsd:element name="AccountReport" type="ftc:CorrectableAccountReport_Type" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>Detailed information for account report, such as account number and account balance</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="PoolReport" type="ftc:CorrectablePoolReport_Type" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>Information about the pool of account holders with similar characteristics</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
但到目前为止的结果并没有像它想象的那样去。 Unexpected result
这是我想要的结果: Expected result
我如何归档预期结果?请指教我。
请注意,在这种情况下,两者都是可选的。
答案 0 :(得分:0)
目前,您可以选择NilReport元素和其他两个元素的序列。
如果你想让另外两个元素作为&#34;序列&#34;的子元素。您将不得不创建一个包含元素,您需要将它们定义为该元素的子元素,如下所示。
<xsd:choice>
<xsd:element name="NilReport" type="ftc:CorrectableNilReport_Type">
<xsd:annotation>
<xsd:documentation xml:lang="en">Nil Report indicates
that financial institution does not have accounts to report</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="NotNilReport">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="AccountReport" type="ftc:CorrectableAccountReport_Type"
minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>Detailed information for account report, such
as account number and account balance</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="PoolReport" type="ftc:CorrectablePoolReport_Type"
minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>Information about the pool of account holders
with similar characteristics</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>