RSS 文件在 Firefox 中未按预期呈现!
我有一个 rss XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>ABC News</title>
<link></link>
<description></description>
<copyright></copyright>
<lastBuildDate>Mon, 26 Oct 2009 17:49:44 +05-30</lastBuildDate>
<generator>Super Simple RSS</generator>
<webMaster></webMaster>
<item>
<title>Get Visual Studio</title>
<link>http://www.visual-studio.com</link>
<description>
<hr></hr>
</description>
</item>
<item>
<title>Get Windows 7</title>
<link>http://www.windows7.com</link>
<description>
Enter Text Here
</description>
</item>
</channel>
</rss>
它可以在 IE 中正确呈现,但不能在 Firefox 中呈现。 Firefox 显示一条消息“此 XML 文件似乎没有任何与之关联的样式信息。文档树如下所示。”并将其呈现为 XML 树。但在 IE 上,它按照我想要的方式呈现。
替代文本 http://img188.imageshack.us/img188/4980/rssoz.jpg< /a>
甚至无法猜测它在 IE 上是如何工作的。请帮忙。我错过了什么吗?
I have an rss XML file:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>ABC News</title>
<link></link>
<description></description>
<copyright></copyright>
<lastBuildDate>Mon, 26 Oct 2009 17:49:44 +05-30</lastBuildDate>
<generator>Super Simple RSS</generator>
<webMaster></webMaster>
<item>
<title>Get Visual Studio</title>
<link>http://www.visual-studio.com</link>
<description>
<hr></hr>
</description>
</item>
<item>
<title>Get Windows 7</title>
<link>http://www.windows7.com</link>
<description>
Enter Text Here
</description>
</item>
</channel>
</rss>
It renders properly in IE but not in firefox. Firefox displays a message "This XML file does not appear to have any style information associated with it. The document tree is shown below." and renders it as a XML tree. But on IE, it renders as I want.
alt text http://img188.imageshack.us/img188/4980/rssoz.jpg
Can't even guess how is it working on IE. Please help. Am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,RSS 只是可聚合信息编码的模式 - 它根本不提供任何显示语义。它似乎有效的原因是 IE 有一个内置的 RSS 提要 HTML 转换功能(Safari 也是如此),因此它们将 RSS 转换为更人性化的内容。 Firefox 默认情况下没有。
您可以通过提供自己的 XSLT 文件来解决此问题,该文件提供特定的 RSS->XHTML 转换,这样所有浏览器都会显示相同的结果。
Well, RSS is just a schema for the encoding of syndicatable information - it doesn't give any display semantics at all. The reason it seems to work is that IE has a builtin transform to HTML for RSS feeds (as does Safari), so they convert the RSS into something more human friendly. Firefox, by default does not.
You can fix this by providing your own XSLT file that gives a specific RSS->XHTML transformation, so that all browsers will display the same result.
也许您应该考虑 W3C Feed 验证服务 的建议,然后指定一个样式表来帮助呈现作为网页查看时的页面。
Maybe you should consider the advices of W3C Feed Validation Service and then specify a style sheet for helping render the page when viewed as a web page.
嘿...得到了答案...是
造成了问题。 Firefox 中需要该节点的值...
看起来很奇怪,但解决了我的问题! :-)
Hey...got the answer....it was the
<link></link>
which was creating the problem. The value for the node is required in Firefox...Looks weired but solves my problem !! :-)