XML解析错误:文档末尾的额外内容 [英] XML Parsing error: Extra content at the end of the document

查看:438
本文介绍了XML解析错误:文档末尾的额外内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的xml文件中出现此错误:XML Parsing error: Extra content at the end of the document

I am getting this error in my xml file: XML Parsing error: Extra content at the end of the document

我正在使用Notepad ++,它在标题标签<ABC BLAH>hello</ABC BLAH>中以红色显示了第二个单词-它以红色显示了 BLAH .因此,我假设问题出在标题标记的空白中,并在该行引发验证错误.我该如何解决?

I am using Notepad++ and it shows the second word in red in the header tags <ABC BLAH>hello</ABC BLAH> - it shows the BLAH in red. Because of this, I assume the problem is in the whitespace in the header tags and throws a validation error at that line. How do I resolve this?

这是xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<rows>
    <row>
        <Order>1</Order>
        <Requirements>ABC</Requirements>
        <Testing Procedures>blah blah </Testing Procedures> 
        <Assessment Observations / Comments>blah blah</Assessment Observations / Comments> <-- throws Parsing error at this line.
    </row>
</rows>

推荐答案

<Testing Procedures="">blah blah </Testing Procedures>

元素名称中不能包含空格.

Can't have spaces in element names.

<Assessment Observations="" / Comments>blah blah</Assessment Observations / Comments>

这也有多个错误.也许你是这个意思? :

Also this has multiple errors. Maybe you meant this ? :

<?xml version="1.0" encoding="UTF-8"?>
<rows>
  <row>
    <Order>1</Order>
    <Requirements>ABC</Requirements>
    <TestingProcedures foo=" ">blah blah </TestingProcedures>
    <Assessment Observations="/ Comments>blah blah"/>
    <Assessment Observations=" / Comments"/>
  </row>
</rows>

您有多个错误.真的无法说出您要做什么.

You have multiple errors. Can't really tell what you are trying to do.

确定.xml 101:

OK .xml 101:

XML不允许在元素名称中使用空格.

XML doesn't permit spaces in element names.

如果不关闭元素名称,则可以指定这样的属性.

If you don't close the element name you can specify attributes like this.

<foo bar="I am an attribute" lol="Me too"> Here you can specify text, or other elements </foo>

此外,如果一个元素不包含另一个元素或文本,则可以使用速记符号

In addition if an element doesn't contain another one , or a text you can use the shorthand notation

<foo attribute="bar"/>

我建议您阅读一些基本的教程.

I suggest you read some basic tutorial for this.

这篇关于XML解析错误:文档末尾的额外内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆