为什么我得到解析XML声明错误?

时间:2011-12-14 19:25:16

标签: xml google-chrome browser

我正在阅读的Chrome浏览器错误

error on line 1 at column 35: parsing XML declaration: '?>' expected

我不明白为什么它显然出现'?>' expected。看看下面的代码

<?xml version="1.0" standalone="yes" encoding="UTF-8"?>

<people>
    <work>
        <george height="5 11" weight="320" hairColor="No Hair">
            <address>123 Anywhere Street</address>
            <carType>No Car</carType>
            <phone>18001116585</phone>
            <favFood>Anything and Everything</favFood>
        </george>
        <paul height="5 5" weight="120" hairColor="Brown">                   
            <address>11 Sendai Street</address>
            <carType>Ford</carType>
            <phone>19731352675</phone>
            <favFood>Pizza</favFood>
        </paul>
        <jen height="5 2" weight="100" hairColor="Auburn">
            <address>94 Frelo Way</address>
            <carType>Lexus</carType>
            <phone>18981456545</phone>
            <favFood>Sushi</favFood>
        </jen>
    </work>
    <home>
    </home>
</people>      

感谢您的解决方案

2 个答案:

答案 0 :(得分:4)

encoding="UTF-8"必须出现在standalone="yes"之前。

spec says

 XMLDecl    ::=      '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

订单很重要。

答案 1 :(得分:1)

属性的顺序应该是版本,编码,独立。