xml 如何解决这个错误“元素类型“head”必须由匹配的结束标记“</head>”终止?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1774853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve this error "The element type "head" must be terminated > by the matching end-tag "</head>"?
提问by Jitendra Vyas
Why i'm getting this error
为什么我收到这个错误
Using org.apache.xerces.parsers.SAXParser Exception net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException: The element type "head" must be terminated by the matching end-tag "". org.xml.sax.SAXParseException: The element type "head" must be terminated by the matching end-tag "".
使用 org.apache.xerces.parsers.SAXParser 异常 net.sf.saxon.trans.XPathException:org.xml.sax.SAXParseException:元素类型“head”必须由匹配的结束标记“”终止。org.xml.sax.SAXParseException:元素类型“head”必须以匹配的结束标记“”结尾。
When i check this site http://visaraimpex.com/in http://www.w3.org/2003/12/semantic-extractor.html
当我在http://www.w3.org/2003/12/semantic-extractor.html 中查看此站点时http://visaraimpex.com/
回答by Stephen C
I think that these two lines are part of the problem:
我认为这两行是问题的一部分:
<script src="js/jquery-1.3.2.min.js" type="text/javascript"/></script>
<script src="js/dropdown.js" type="text/javascript"/></script>
Since this is XHTML (according to the DOCTYPE), you can either change "/>" to ">", or delete the "</script>".
由于这是 XHTML(根据 DOCTYPE),您可以将“/>”更改为“>”,或删除“</script>”。
This illustrates the kind of problems you have trying to extract stuff from real-world HTML. If that is what you are doing, maybe you should be using HTMLTidy or a similar "permissive" HTML parser rather than a strict parser.
这说明了您尝试从现实世界的 HTML 中提取内容时遇到的问题。如果这就是你正在做的,也许你应该使用 HTMLTidy 或类似的“许可”HTML 解析器而不是严格的解析器。
回答by pafcu
You close your <script> tags twice:
您关闭 <script> 标签两次:
<script src="js/jquery-1.3.2.min.js" type="text/javascript"/></script>
Remove </script> and it should work.
删除 </script> ,它应该可以工作。
回答by InfantPro'Aravind'
Replace the head part of your HTML code with the following snippet:
用以下代码段替换 HTML 代码的头部:
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Visara Impex</title>
<meta name="keywords" content="">
<meta name="Visara Impex" content="">
<link href="default.css" rel="stylesheet" type="text/css" media="screen">
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/dropdown.js" type="text/javascript"></script>
<script type="text/javascript" src="js/rb.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#menu li:nth-child(1)").addClass("current_page_item");
$("#menu").css("background" , "url(images/nav/7.jpg) no-repeat left top");
});
</script>
</head>

