RSS <channel>Element
The <channel> element of RSS can describe an RSS feed.
RSS <channel> Element
See the following RSS document:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Example首页</title>
<link>http://www.example.com</link>
<description>免费编程教程</description>
<item>
<title>RSS 教程</title>
<link>http://www.example.com/rss</link>
<description>Example Rss 教程</description>
</item>
</channel>
</rss>
As mentioned earlier, the <channel> element can describe an RSS feed, and it has three required child elements:
- <title> - defines the title of the channel. (For example, Example Homepage)
- <link> - defines the hyperlink to the channel. (For example, http://www.example.com)
- <description> - describes the channel (for example, Free Programming Tutorials)
<channel> usually contains one or more <item> elements. Each <item> element can define an article or "story" in the RSS feed.
In addition, there are several optional child elements of <channel>. We will explain the most important ones later.
<category> Element
The <category> child element is used to specify a category for the feed.
The <category> child element makes it possible for RSS aggregators to group websites by category.
The category of the above RSS document might be:
<category>Web 开发</category>
<copyright> Element
The <copyright> child element provides information about copyright.
The copyright of the above RSS document might be:
<copyright>2006 Refsnes Data as. All rights reserved.</copyright>
<image> Element
The <image> child element can display an image when the aggregator presents a feed.
<image> has three required child elements:
- <url> - defines the URL that references the image
- <title> - defines the text displayed when the image cannot be shown
- <link> - defines the hyperlink to the website that provides the channel
The image of the above RSS document might look like this:
<image> <url>http://www.example.com/images/logo.png</url> <title>Example</title> <link>http://www.example.com</link> </image>
<language> Element
The <language> child element is used to specify the language used to write the document.
The <language> element makes it possible for RSS aggregators to group websites based on language.
The language of the above RSS document might be:
<language>zh-cn</language>
RSS <channel> Reference Manual
| Element | Description |
|---|---|
| <category> | Optional. Defines one or more categories for the feed. |
| <cloud> | Optional. Registers a process to receive immediate notification of feed updates. |
| <copyright> | Optional. Provides copyright information. |
| <description> | Required. Describes the channel. |
| <docs> | Optional. Specifies the URL pointing to the documentation for the format used in the current RSS file. |
| <generator> | Optional. Specifies the program used to generate the feed. |
| <image> | Optional. Displays an image when an aggregator presents a feed. |
| <language> | Optional. Specifies the language used to write the feed. |
| <lastBuildDate> | Optional. Defines the last modified date of the feed content. |
| <link> | Required. Defines the hyperlink to the channel. |
| <managingEditor> | Optional. Defines the email address of the editor of the feed content. |
| <pubDate> | Optional. Defines the last publication date for the feed's content. |
| <rating> | Optional. PICS rating of the feed. |
| <skipDays> | Optional. Specifies days on which feed updates are ignored. |
| <skipHours> | Optional. Specifies hours on which feed updates are ignored. |
| <textInput> | Optional. Specifies a 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 it is updated from the feed source. |
| <webMaster> | Optional. Defines the email address of the web administrator of this feed. |