【发布时间】:2012-09-08 02:51:17
【问题描述】:
准确地说...一个有效的提要中的<item> 中是否可以存在多个<content:encoded> 元素?
全文:我正在为Google Currents 修改我博客的 RSS 提要的标记,并且为了让应用程序以幻灯片形式在文章中显示图片库,我的提要的标记应如下所示:
<rss version="2.0" ... xmlns:media="http://search.yahoo.com/mrss/">
...
<item>
<title>Item One</title>
<link>http://example.com/news/item-one</link>
<description>
<p>This is an example feed item</p>
</description>
...
<pubDate>Thu, 04 Aug 2011 19:41:00 GMT</pubDate>
<guid>http://example.com/news/item-one</guid>
<media:content height="84" type="image/jpeg" width="140" url="http://static.example.com/photo1.jpg">
<media:description>Caption for Photo 1</media:description>
</media:content>
<media:content height="100" type="image/jpeg" width="200" url="http://static.example.com/photo2.jpg">
<media:description>Caption for Photo 2</media:description>
</media:content>
<content:encoded><![CDATA[
<p>All the content goes here.</p>
<p>This is another line.</p>
]]></content:encoded>
...
</item>
...
</rss>
但由于我的 WordPress 博客的工作方式,画廊会显示在文章中(这很常见),这意味着 RSS 提要中也会发生同样的情况。但是<media:content>元素不能是<content:encoded>的子元素。
所以,我想知道我是否可以这样做并且它仍然是有效的 RSS 提要:
<rss version="2.0" ... xmlns:media="http://search.yahoo.com/mrss/">
...
<item>
<title>Item One</title>
<link>http://example.com/news/item-one</link>
<description>
<p>This is an example feed item</p>
</description>
...
<pubDate>Thu, 04 Aug 2011 19:41:00 GMT</pubDate>
<guid>http://example.com/news/item-one</guid>
<content:encoded><![CDATA[
<p>All the content goes here.</p>
]]></content:encoded>
<media:content height="84" type="image/jpeg" width="140" url="http://static.example.com/photo1.jpg">
<media:description>Caption for Photo 1</media:description>
</media:content>
<media:content height="100" type="image/jpeg" width="200" url="http://static.example.com/photo2.jpg">
<media:description>Caption for Photo 2</media:description>
</media:content>
<content:encoded><![CDATA[
<p>This is another line.</p>
]]></content:encoded>
...
</item>
...
</rss>
如您所见,我基本上会将<content:encoded> 元素一分为二,为幻灯片标记让路。所以,<item> 中会有两个<content:encoded> 元素。可以吗?
【问题讨论】:
-
您是否通过验证器运行它?