<?xml version="1.0" encoding="UTF-8"?>
<type id = "player"/>
<type id = "spider"/>
<type id = "spider"/>第二行处报错误:
“The up in the document following the root element must be well-formed.”
但如果文件时这样:
<?xml version="1.0" encoding="UTF-8"?>
<type id = "player"/>
就不会报错。请问,为什么会有这个错误?如何更改?

解决方案 »

  1.   

    the root element must be well-formed 你定义了多个根元素。这样试试:<?xml version="1.0" encoding="UTF-8"?>
    <root>
    <type id = "player"/>
    <type id = "spider"/>
    <type id = "spider"/>
    </root>
      

  2.   

    肯定会报错了
    XML 文档只能有一个顶层元素,也就是根结点。
    <?xml version="1.0" encoding="UTF-8"?>
    <type id = "player"/>
    <type id = "spider"/>
    <type id = "spider"/>
    你这样写,就有多个相同的根结点,肯定会错。<?xml version="1.0" encoding="UTF-8"?>
    <type id = "player"/>
    这样写就一个根结点type,肯定不会报错了。问题解决了,记得结贴!