2012-09-08 46 views
1

正...可以在多個<content:encoded>元素有效供稿的<item>內部存在?在供稿中,<item>內可以存在多個<content:encoded>元素嗎?


全文:我改裝我的博客的RSS標記飼料爲Google Currents,併爲應用在如幻燈片文章顯示圖像畫廊,我進的標記應該是這樣的:

<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>元素。可以嗎?

+0

你有沒有通過驗證運行呢? – random

回答

0

通過W3C's Feed Validation Service運行我的饋送,答案似乎爲「是」,多個<content:encoded>元素可以存在於Feed中的<item>內。

相關問題