元素类型“META”必须由匹配的结束标记“< / META>”来终止。 [英] The element type "META" must be terminated by the matching end-tag "</META>"

查看:752
本文介绍了元素类型“META”必须由匹配的结束标记“< / META>”来终止。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我尝试使用Java解析XML文件(在GAE服务器中)时,出现以下错误:

  Parse:org.xml.sax.SAXParseException; lineNumber:10; columnNumber:3;元素类型META必须由匹配的结束标签< / META>终止。 

然而,它并非一直在发生,有时候它是行得通的。该程序解析XML文件,我没有与他们的问题。

这是我试图解析的XML文件:
http://www.fulhamchronicle.co.uk/london-chelsea-fc/rss.xml



任何帮助将不胜感激。谢谢。




更新:

感谢您的回答。我将我的代码更改为不同的分析器,并且文件现在正确解析的好消息。
它现在移动到另一个饲料相同的问题,尽管完全不同的饲料,它完美的工作之前完全相同的行。任何人都可以想到它为什么会发生?

即相当频繁改变的一个。也没有< meta> 标记的迹象。



我可以想到两个解释发生了什么:




  • 有时文档正在生成或创建不正确。


  • 有时候你得到一个HTML错误页面而不是你期望的文档,而XML解析器不能处理< meta> 标记在HTML的< head> 中。这是因为(有效)HTML中的< meta> 标记不需要匹配/关闭< / meta> 标签。 (至少对于某些版本的HTML,它不允许有结束标记。)

  • 这一点,你将不得不捕捉导致解析失败的精确输入。


    I've got the following error sometimes when I'm try to parse a XML file with Java (within GAE server):

    Parse: org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 3; The element type "META" must be terminated by the matching end-tag "</META>".
    

    Yet it is not happening all the time, sometimes It's works alright. The program parsing xml files and I've no problem with them.

    This is the XML file I'm trying to parse: http://www.fulhamchronicle.co.uk/london-chelsea-fc/rss.xml

    Any help will be appreciated. Thanks.


    Update:

    Thanks for the answer. I changed my code to a different parser and the good news the file is now parsing correctly. The bad it now moved for another feed same problem, same line despite completely different feed and it worked perfectly before. Could anyone think of why it's happening?

    解决方案

    That looks like it is a live document; i.e. one that changes fairly frequently. There is also no sign of a <meta> tag in it.

    I can think of two explanations for what is happening:

    • Sometimes the document is being generated or created incorrectly.

    • Sometimes you are getting an HTML error page instead of the document you are expecting, and the XML parser can't cope with a <meta> tag in the HTML's <head>. That is because the <meta> tag in (valid) HTML does not need to have a matching / closing </meta> tag. (And for at least some versions of HTML, it is not allowed to have a closing tag.)

    To track this down, you are going to have to capture the precise input that is causing the parse to fail.

    这篇关于元素类型“META”必须由匹配的结束标记“&lt; / META&gt;”来终止。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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