我正在尝试使用XML::Validator::Schema针对架构验证 xml 文件。
但它给了我这个错误:
Found unexpected <Submission> inside <<<<ROOT>>>>. This is not a valid child element. [Ln: 2, Col:119]
注意:<Submission>
是我之后的第一个元素<xml version="1.0" encoding="UTF-8"?>
我不明白这意味着什么。
感谢任何帮助。
XML 是:
<?xml version="1.0" encoding="utf-8"?>
<Submission xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layout-topologie.xsd">
<Return>
<NR4>
<NR4Slip>
<RCPNT_NM>
<snm>SYMPSOM</snm>
<gvn_nm>HOMER</gvn_nm>
<init>A</init>
</RCPNT_NM>
<SEC_RCPNT_NM></SEC_RCPNT_NM>
<RCPNT_ADDR>
<addr_l1_txt>C/O ABC A/C 555 6666</addr_l1_txt>
<addr_l2_txt>9999 - 88 STREET</addr_l2_txt>
<cntry_cd>CAN</cntry_cd>
<fgn_pstl_cd>T4S1M5</fgn_pstl_cd>
</RCPNT_ADDR>
<fssn_nbr>607-448-900</fssn_nbr>
<nr_acct_nbr>NRY454080</nr_acct_nbr>
<rcpnt_tcd>01</rcpnt_tcd>
<payr_nbr>100000</payr_nbr>
<inc_1_tcd>11</inc_1_tcd>
<crcy_1_cd>CAD</crcy_1_cd>
<tx_xmpt_1_cd>AB</tx_xmpt_1_cd>
<inc_2_tcd>02</inc_2_tcd>
<crcy_2_cd>CAD</crcy_2_cd>
<tx_xmpt_2_cd>PQ</tx_xmpt_2_cd>
<NR4_AMT>
<gro_1_incamt>1.1</gro_1_incamt>
<nr_tx_1_amt>0.00</nr_tx_1_amt>
<gro_2_incamt>90000000</gro_2_incamt>
<nr_tx_2_amt>0.00</nr_tx_2_amt>
</NR4_AMT>
<rpt_tcd>O</rpt_tcd>
</NR4Slip>
<NR4Slip>
<RCPNT_NM>
<snm>CARTMAN</snm>
<gvn_nm>ERIC</gvn_nm>
</RCPNT_NM>
<SEC_RCPNT_NM>
<sec_snm>SYMPSON</sec_snm>
<sec_gvn_nm>BART</sec_gvn_nm>
</SEC_RCPNT_NM>
<RCPNT_ADDR>
<addr_l1_txt>C/O DEFG A/C 555 2222</addr_l1_txt>
<addr_l2_txt>9999 - 88 STREET</addr_l2_txt>
<cntry_cd>CAN</cntry_cd>
<fgn_pstl_cd>T4S1M5</fgn_pstl_cd>
</RCPNT_ADDR>
<fssn_nbr>607-448-901</fssn_nbr>
<nr_acct_nbr>NRY454080</nr_acct_nbr>
<rcpnt_tcd>01</rcpnt_tcd>
<payr_nbr>200000</payr_nbr>
<inc_1_tcd>11</inc_1_tcd>
<crcy_1_cd>USD</crcy_1_cd>
<tx_xmpt_1_cd>BC</tx_xmpt_1_cd>
<inc_2_tcd>02</inc_2_tcd>
<crcy_2_cd>USD</crcy_2_cd>
<tx_xmpt_2_cd>QR</tx_xmpt_2_cd>
<NR4_AMT>
<gro_1_incamt>20.01</gro_1_incamt>
<nr_tx_1_amt>10</nr_tx_1_amt>
<gro_2_incamt>8000000</gro_2_incamt>
<nr_tx_2_amt>0.1</nr_tx_2_amt>
</NR4_AMT>
<rpt_tcd>O</rpt_tcd>
</NR4Slip>
<NR4Summary>
<PAYR_NM>
<l1_nm>THE BANK OF NOVA SCOTIA</l1_nm>
</PAYR_NM>
<PAYR_ADDR>
<addr_l1_txt>HR SHARED SERVICES PENSION DEPT.</addr_l1_txt>
<addr_l2_txt>7TH FLOOR, 888 BIRCHMOUNT ROAD</addr_l2_txt>
</PAYR_ADDR>
<tx_yr>2007</tx_yr>
<slp_cnt>10</slp_cnt>
</NR4Summary>
</NR4>
</Return>
</Submission>
XSD 是:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- @@@@ Definition of NR4 ComplexTypes @@@@ 2008/sept/03 Version# 2.8 -->
<xsd:complexType name="NR4SlipType">
<xsd:all>
<xsd:element name="RCPNT_NM" type="NameType" minOccurs="0"/>
<xsd:element name="SEC_RCPNT_NM" type="NameType_2" minOccurs="0"/>
<xsd:element name="ENTPRS_NM" type="NR4_Line2Type" minOccurs="0"/>
<xsd:element name="RCPNT_ADDR" type="NR4ForeignAddressType" minOccurs="0"/>
<xsd:element name="tx_cntry_cd" type="char3Type"/>
<xsd:element name="fssn_nbr" type="char20Type"/>
<xsd:element name="nr_acct_nbr" type="nrType"/>
<xsd:element name="rcpnt_tcd" type="indicator1-5Type"/>
<xsd:element name="payr_nbr" type="char20Type" minOccurs="0"/>
<xsd:element name="inc_1_tcd" type="numeric2Type" minOccurs="0"/>
<xsd:element name="crcy_1_cd" type="char3Type" minOccurs="0"/>
<xsd:element name="NR4_AMT" type="NR4AmountType" minOccurs="0"/>
<xsd:element name="tx_xmpt_1_cd" type="char1Type" minOccurs="0"/>
<xsd:element name="inc_2_tcd" type="numeric2Type" minOccurs="0"/>
<xsd:element name="crcy_2_cd" type="char3Type" minOccurs="0"/>
<xsd:element name="tx_xmpt_2_cd" type="char1Type" minOccurs="0"/>
<xsd:element name="rpt_tcd" type="slipDataType"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="NR4AmountType">
<xsd:all>
<xsd:element name="gro_1_incamt" type="decimal11Type" minOccurs="0"/>
<xsd:element name="nr_tx_1_amt" type="decimal11Type" minOccurs="0"/>
<xsd:element name="gro_2_incamt" type="decimal11Type" minOccurs="0"/>
<xsd:element name="nr_tx_2_amt" type="decimal11Type" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="NR4SummaryType">
<xsd:all>
<xsd:element name="nr_acct_nbr" type="nrType"/>
<xsd:element name="PAYR_NM" type="Line3Type"/>
<xsd:element name="PAYR_ADDR" type="NR4CanadaAddressType" minOccurs="0"/>
<xsd:element name="CNTC" type="ContactType2"/>
<xsd:element name="tx_yr" type="yearType"/>
<xsd:element name="slp_cnt" type="int7Type"/>
<xsd:element name="rmt_tcd" type="indicator1-2Type" minOccurs="0"/>
<xsd:element name="rpt_tcd" type="otherDataType"/>
<xsd:element name="NR4_TAMT" type="NR4TotalsType" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="NR4TotalsType">
<xsd:all>
<xsd:element name="tot_gro_1_incamt" type="decimal13Type" minOccurs="0"/>
<xsd:element name="tot_nr_tx_1_amt" type="decimal13Type" minOccurs="0"/>
<xsd:element name="tot_gro_2_incamt" type="decimal13Type" minOccurs="0"/>
<xsd:element name="tot_nr_tx_2_amt" type="decimal13Type" minOccurs="0"/>
<xsd:element name="tot_nrpt_incamt" type="decimal13Type" minOccurs="0"/>
<xsd:element name="tot_nr_nrpt_tx_amt" type="decimal13Type" minOccurs="0"/>
</xsd:all>
<xsd:attribute name="tot_incamt" type="xsd:string"/>
<xsd:attribute name="tot_tx_wthld" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>