XML Error: Extra content at the end of the document

前端 未结 2 1492
眼角桃花
眼角桃花 2020-12-17 08:20

This is the XML:



Sample Document
document

        
相关标签:
2条回答
  • 2020-12-17 08:45

    You need a root node

    <?xml version="1.0" encoding="ISO-8859-1"?>    
    <documents>
        <document>
            <name>Sample Document</name>
            <type>document</type>
            <url>http://nsc-component.webs.com/Office/Editor/new-doc.html?docname=New+Document&amp;titletype=Title&amp;fontsize=9&amp;fontface=Arial&amp;spacing=1.0&amp;text=&amp;wordcount3=0</url>
        </document>
    
        <document>
            <name>Sample</name>
            <type>document</type>
            <url>http://nsc-component.webs.com/Office/Editor/new-doc.html?docname=New+Document&amp;titletype=Title&amp;fontsize=9&amp;fontface=Arial&amp;spacing=1.0&amp;text=&amp;</url>
        </document>
    </documents>
    
    0 讨论(0)
  • 2020-12-17 08:46

    I've found that this error is also generated if the document is empty. In this case it's also because there is no root element - but the error message "Extra content and the end of the document" is misleading in this situation.

    0 讨论(0)
提交回复
热议问题