"XML解析错误:文档元素后出现垃圾"< body>上的错误标签 [英] "XML Parsing Error: junk after document element" error on <body> tag
本文介绍了"XML解析错误:文档元素后出现垃圾"< body>上的错误标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试检查我的html是否也是格式正确的xml,但是我一直在body标签上收到此错误,
I am trying to check if my html is a well formed xml as well but I am keep getting this error on the body tag,
XML Parsing Error: junk after document element
Location: location/index.xml
Line Number 10, Column 1:
<body>
^
这是代码,
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<title></title>
<link href="style/style.css" rel="stylesheet" type="text/css"/>
<link rel="icon" href="images/favicon.ico" />
</head>
<body>
<main>
<header>
</header>
<nav >
</nav>
<article>
</article>
</main>
<div class="push"></div>
<footer>
</footer>
</body>
</html>
我为什么会收到此错误?
Whhy am I getting this error ?
推荐答案
您忘了以 html
标记开头.将 head
元素用作根元素,并且在该根元素之后有一个垃圾( body
)(只允许孩子,不允许root的兄弟姐妹).
You forgot to start with an html
tag. The head
element is taken as a root element and there is a junk (body
) after this root element (just children, not siblings of root are allowed).
<!DOCTYPE html>
<html> <!-- here -->
<head>
<meta charset="UTF-8" />
<title></title>
<link href="style/style.css" rel="stylesheet" type="text/css"/>
<link rel="icon" href="images/favicon.ico" />
</head>
<body>
<main>
<header>
</header>
<nav >
</nav>
<article>
</article>
</main>
<div class="push"></div>
<footer>
</footer>
</body>
</html>
这篇关于"XML解析错误:文档元素后出现垃圾"< body>上的错误标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文