坚持 XML 验证架构

问题描述

我正在尝试使用 XSD XML 验证架构创建 XML 文件

但我被困在“多行数据”上。无法解决那个问题。

我的指导方针:https://www.oecd.org/tax/beps/country-by-country-reporting-xml-schema-user-guide-for-tax-administrations-june-2019.pdf 我的 XSD:https://www.oecd.org/ctp/exchange-of-tax-information/CbC-Schema-v2.0.zip

到这里看起来没问题。

但是,从 XSD 架构,我创建了 XML 示例。而且不知道如何在里面整合数据。

XML 示例:

...
    <ns2:CbcReports>
        <ns2:ResCountryCode>AF</ns2:ResCountryCode>
        <ns2:Summary>
            <ns2:Revenues>
                <ns2:Unrelated currCode="AED">76</ns2:Unrelated>
                <ns2:Related currCode="AED">2949</ns2:Related>
                <ns2:Total currCode="AED">7859</ns2:Total>
            </ns2:Revenues>
            <ns2:ProfitOrLoss currCode="AED">13486</ns2:ProfitOrLoss>
            <ns2:TaxPaid currCode="AED">17364</ns2:TaxPaid>
            <ns2:TaxAccrued currCode="AED">14015</ns2:TaxAccrued>
            <ns2:Capital currCode="AED">19022</ns2:Capital>
            <ns2:Earnings currCode="AED">27690</ns2:Earnings>
            <ns2:NbEmployees>5500</ns2:NbEmployees>
            <ns2:Assets currCode="AED">26679</ns2:Assets>
        </ns2:Summary>
        <ns2:ConstEntities>
            <ns2:ConstEntity>
                <ns2:ResCountryCode>AF</ns2:ResCountryCode>
                <ns2:TIN issuedBy="AF">AABBCCDDEE</ns2:TIN>
                <ns2:IN issuedBy="AF" INType="AABBCCDDEE">AABBCCDDEE</ns2:IN>
                <ns2:Name>AABBCCDDEE</ns2:Name>
                <ns2:Address legalAddresstype="OECD301">
                    <ns2:CountryCode>AF</ns2:CountryCode>
                    <ns2:AddressFree>AABBCCDDEE</ns2:AddressFree>
                </ns2:Address>
            </ns2:ConstEntity>
            <ns2:Role>CBC801</ns2:Role>
            <ns2:IncorpCountryCode>AF</ns2:IncorpCountryCode>
            <ns2:BizActivities>CBC501</ns2:BizActivities>
            <ns2:OtherEntityInfo>AABBCCDDEE</ns2:OtherEntityInfo>
        </ns2:ConstEntities>
    </ns2:CbcReports>
...

我必须有多行数据,我不知道如何在这个 XML 中传递多行数据。

数据在下面,但是我怎样才能像下面那样使用那个 XML?

如何发送多行数据?

enter image description here

这是我必须做的吗?

<CbcReports> 
  Italy blablabla
</CbcReports>
<CbcReports> 
  USA blablabla
</CbcReports>

解决方法

本文件

<CbcReports> 
  Italy blablabla
</CbcReports>
<CbcReports> 
  USA blablabla
</CbcReports>

不是一个格式良好的 XML 文档,因为它有多个根标签。

我建议您在尝试解决问题之前先阅读一些有关 XML 和 XSD 的背景资料。