根元素过多的XML错误

时间:2015-12-10 07:22:37

标签: xml

我收到错误

  

有多个根元素

以下是我的代码,我在此论坛上看到了其他回复,但我没有任何帮助。请检查我的代码,让我知道我在哪里执行错误的操作:

<?xml version="1.0"?> 
<DAM>
    <xcnF_DEV_RELATIONS.DRE_FNAME>EPS_JPG_PSEERE140P000001.eps</xcnF_DEV_RELATIONS.DRE_FNAME>
    <xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME>
    <xcnF_DERIVATE.DEV_ID>11</xcnF_DERIVATE.DEV_ID>
</DAM>  
<DAM>
    <xcnF_DEV_RELATIONS.DRE_FNAME>EPS_REGULAR_PSEERE140P000001.eps</xcnF_DEV_RELATIONS.DRE_FNAME>
    <xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME>
    <xcnF_DERIVATE.DEV_ID>11</xcnF_DERIVATE.DEV_ID>
</DAM>
<DAM>
    <xcnF_DEV_RELATIONS.DRE_FNAME>JPEG_PSEERE140P000001.jpg</xcnF_DEV_RELATIONS.DRE_FNAME>
    <xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME>
    <xcnF_DERIVATE.DEV_ID>11</xcnF_DERIVATE.DEV_ID>
</DAM>
<DAM>
    <xcnF_DEV_RELATIONS.DRE_FNAME>LV_PSEERE140P000001.jpg</xcnF_DEV_RELATIONS.DRE_FNAME>
    <xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME>
    <xcnF_DERIVATE.DEV_ID>12</xcnF_DERIVATE.DEV_ID>
</DAM>
<DAM>
    <xcnF_DEV_RELATIONS.DRE_FNAME>PN_PSEERE140P000001.jpg</xcnF_DEV_RELATIONS.DRE_FNAME>
   <xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME>
   <xcnF_DERIVATE.DEV_ID>13</xcnF_DERIVATE.DEV_ID>
</DAM>
<DAM>
 <xcnF_DEV_RELATIONS.DRE_FNAME>PV_PSEERE140P000001.jpg</xcnF_DEV_RELATIONS.DRE_FNAME><xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME><xcnF_DERIVATE.DEV_ID>14</xcnF_DERIVATE.DEV_ID></DAM>
.........

1 个答案:

答案 0 :(得分:1)

错误消息说明了一切 - 你有太多(=多个)根元素(<DAM>)。将文件更改为

之类的结构
<?xml version="1.0"?> 
<root>
    <DAM>
        <xcnF_DEV_RELATIONS.DRE_FNAME>EPS_JPG_PSEERE140P000001.eps</xcnF_DEV_RELATIONS.DRE_FNAME>
        <xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME>
        <xcnF_DERIVATE.DEV_ID>11</xcnF_DERIVATE.DEV_ID>
    </DAM>  
    <DAM>
        <xcnF_DEV_RELATIONS.DRE_FNAME>EPS_REGULAR_PSEERE140P000001.eps</xcnF_DEV_RELATIONS.DRE_FNAME>
        <xcnF_IMGKOMP.PKOM_NNAME>PSEERE140P000001.eps</xcnF_IMGKOMP.PKOM_NNAME>
        <xcnF_DERIVATE.DEV_ID>11</xcnF_DERIVATE.DEV_ID>
    </DAM>
...
</root>