0
我有以下以下XSD模板: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
我怎麼能存檔預期的結果?請指教我。
請注意,在這種情況下,兩者都是可選的。
嗨@ophychius,我會很感激你的答案。如果不創建包含元素,我們是否真的沒有其他方法來存檔? –
這取決於你想要達到什麼目標,如果你想要一個可以包含NilReport或者PoolReport和/或AccountReport元素組合的元素,而不是你當前的xsd是可以的。它不允許組合NilReport和其他2個組合,同時允許0-n AccountReports和0-n PoolReports 如果您希望Account-和PoolReport在上述元素中組合在一起,您需要一個在NilReport和包含Account-和PoolReport元素的'NotNilReport'之間進行選擇。 也許試着解釋你想要達到的目標? – ophychius
你上面的例子是完美的,但它不遵循其默認模式。所以它正確的xml應該是: FATCA1 ftc:DocTypeIndic> XXXX ftc:DocRefId> \t XXXX ftc:CorrMessageRefId> \t \t \t XXX ftc:CorrDocRefId> ftc:DocSpec> 3 ftc:AccountCount> ftc:AccountPoolReportType> FATCA201 ftc:AccountPoolReportType > 33 ftc:PoolBalance> ftc:PoolReport> ftc:NotNilReport> **沒有標記** –