XML错误元素类型“链接”必须后跟属性规范,“>”或“/>”

时间:2011-12-14 11:16:29

标签: xml

大家好,我想知道为什么我在下面的XML中遇到错误:

7:  88  Element type "links" must be followed by either attribute specifications, ">" or "/>".

下面的XML代码是否有理由发生这种情况?

<?xml version="1.0" encoding="UTF-8" ?><start>
    <firstName>Jae</firstName>
    <lastName>Choi</lastName>
    <companyName>Test Company</companyName>
    <location>Melbourne</location>
    <contacts Phone="12345" Mobile="12312123" Text="" Email=""></contacts>
    <links Facebook="" Twitter="" Site="appscore.com.au" LinkedIn="" test="test12311.com" 1231="hello.com"></links>
    <frontCard>http://blink.wmetools.com/img/cards/Test123_front.png</frontCard>
    <backCard>http://blink.wmetools.com/img/cards/Test123_back.png</backCard>
    <cardID>Test123</cardID>
</start>

2 个答案:

答案 0 :(得分:2)

运行xmllint我得到:

xml.xml:7: parser error : error parsing attribute name
  Facebook="" Twitter="" Site="appscore.com.au" LinkedIn="" test="test12311.com" 

数字无效属性name start characters

答案 1 :(得分:2)

XML名称不能以数字开头,因此您的XML格式不正确,这就是您收到错误的原因。

请参阅spec