RSS <channel> Element

Ang <channel> elemento ng RSS ay naglalarawan ng RSS feed.

RSS <channel> Element

Pansin ang sumusunod na RSS dokumento:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
  <title>CodeW3C.com Home Page</title>
  <link>http://www.codew3c.com</link>
  <description>Free web building tutorials</description>
  <item>
    <title>RSS Tutorial</title>
    <link>http://www.codew3c.com/rss</link>
    <description>New RSS tutorial on CodeW3C.com</description>
  </item>
</channel>
</rss>

Tulad ng nabanggit kamakailan, ang <channel> elemento ay naglalarawan ng RSS feed, at may tatlong kinakailangang sub-element:

  • <title> - nagtutukoy ng pamagat ng channel. (halimbawa, Halaman ng CodeW3C)
  • <link> - nagtutukoy ng hyperlink na darating sa channel. (halimbawa, www.codew3c.com)
  • <description> - naglalarawan ng channel na ito (halimbawa, libreng tutorial sa pagbuo ng website)

<channel> ay karaniwang naglalaman ng isang o ilang <item> elemento. Bawat <item> elemento ay nagtutukoy ng isang artikulo o "story" sa RSS feed.

Sa karagdagan, mayroon ding ilang opisyal na sub-element ng <channel>. Ito ay magiging pagtatalakay sa mga pinakamahalagang ilan sa susunod.

<category> elemento

<category> ang sub-element na ginagamit upang tugmaan ang uri ng feed.

<category> ang sub-element na gumagawa posible na magkakahati ng mga website sa pamamagitan ng kategorya sa RSS aggregator.

Ang kategorya ng RSS dokumento ay maaaring maging:

<category>Web development</category>

<copyright> 元素

<copyright> 子元素會告知有關版本資料的信訊。

上面的 RSS 文檔的版本可能會是

<copyright>2006 codew3c.com. All rights reserved.</copyright>

<image> 元素

<image> 子元素可在聚合器提供某個 feed 時顯示一幅圖像。

<image> 有三個必需的子元素:

  • <url> - 定義引用圖像的 URL
  • <title> - 定義圖像無法被顯示時顯示的文本
  • <link> - 定義到達提供此頻道的網站的超鏈接

上面的 RSS 文檔的圖像可能是這樣的:

<image>
  <url>http://www.codew3c.com/images/logo.gif</url>
  <title>codew3c.com</title>
  <link>http://www.codew3c.com</link>
</image>

<language> 元素

<language> 子元素用於規定用來編寫文檔的語言。

<language> 元素使 RSS 聚合器基於語言來對網站進行分組成為可能。

上面的 RSS 文檔的語言可能是:

<language>en-us</language>

RSS <channel> 參考手冊

元素 描述
<category> 可選的。為 feed 定義屬於的一個或多個種類。
<cloud> 可選的。註冊進程,以獲得 feed 更新的立即通知。
<copyright> 可選。告知版權資料。
<description> 必需的。描述頻道。
<docs> 可選的。規定指向當前 RSS 文件所用格式說明的 URL。
<generator> 可選的。指定用於生成 feed 的程序。
<image> 可選的。在聚合器呈現某個 feed 時,顯示一個圖像。
<language> 可選的。規定編寫 feed 所用的語言。
<lastBuildDate> 可選的。定義 feed 內容的最後修改日期。
<link> 必需的。定義指向頻道的超鏈接。
<managingEditor> 可選的。定義 feed 內容編輯的電子郵件地址。
<pubDate> Optional. Defines the last published date for the feed's content.
<rating> Optional. The PICS rating of the feed.
<skipDays> Optional. Specifies the days to ignore when updating the feed.
<skipHours> Optional. Specifies the hours to ignore when updating the feed.
<textInput> Optional. Specifies the text input field that should be displayed with the feed.
<title> Required. Defines the title of the channel.
<ttl> Optional. Specifies the number of minutes the feed can be cached before updating from the feed source.
<webMaster> Optional. Defines the email address of the webmaster for this feed.