RSS efficient i...login
RSS efficient introductory tutorial
author:php.cn  update time:2022-04-11 14:48:25

RSS <channel> element



The <channel> element of RSS describes an RSS feed.


RSS <channel> element

Please see the following RSS document:

<?xml version="1.0" encoding ="ISO-8859-1" ?>
<rss version="2.0">

<channel>
​ <title>W3Schools Home Page</title>
​ <link>http://www.w3schools.com</link>
​ <description>Free web building tutorials</description>
​ <item>
​​ <title>RSS Tutorial</title>
​​ <link>http://www.w3schools.com/rss</link>
​​ <description>New RSS tutorial on W3Schools</description>
​ </item>
</channel>

</rss>

As mentioned earlier, the <channel> element describes an RSS feed, while Has three required child elements:

  • <title> - Defines the title of the channel. (For example, w3school homepage)

  • <link> - Defines the hyperlink to the channel. (such as www.w3school.com.cn)

  • ##<description> - describe this channel (such as free website building tutorials)

<channel> typically contains one or more <item> elements. Each <item> element defines an article or "story" in the RSS feed.

In addition, there are several optional <channel> sub-elements. We will explain the most important ones later.


<category> Element The

<category> child element is used to specify the category for the feed. The

<category> sub-element makes it possible for RSS aggregators to group websites based on categories.

The category of the above RSS document may be:

<category>Web development</category>

# <copyright> Element

The<copyright> child element tells information about the version material.

The version of the above RSS document may be

<copyright>2006 Refsnes Data as. All rights reserved.</copyright>


<image> Element The

<image> child element displays an image when a feed is provided by an aggregator.

<image> has three required child elements:

  • <url> - defines the URL that references the image

  • <title> - Defines the text to be displayed when the image cannot be displayed

  • ##<link> - Defines the hyperlink to the website that provides this channel

The image of the above RSS document may look like this:

<image>
​ <url>http://www.w3schools.com/images/logo.gif</url>
​ <title>W3Schools.com</title>
​ <link>http://www.w3schools.com</link>
</image>


<language> Element

## The #<language> subelement is used to specify the language in which the document is written. The

<language> element makes it possible for RSS aggregators to group websites based on language.

The language of the above RSS document may be:

<language>en-us</language>


RSS <channel> Reference Manual

ElementDescription
<category>Optional. Defines one or more categories for the feed.
<cloud>Optional. Register a process to get immediate notification of feed updates.
<copyright>Optional. Notify copyrighted material.
<description>Required. Describe the channel.
<docs>Optional. Specifies the URL pointing to the format description used by the current RSS file.
<generator>Optional. Specifies the program used to generate the feed.
<image>Optional. Display an image when the aggregator renders a feed.
<language>Optional. Specifies the language in which the feed is written.
<lastBuildDate>Optional. Defines the date the feed content was last modified.
<link>Required. Defines the hyperlink to the channel.
<managingEditor>Optional. Defines the email address of the feed content editor.
<pubDate>Optional. Defines the last published date for the feed's content.
<rating>Optional. The PICS level of the feed.
<skipDays>Optional. Specifies days to ignore feed updates.
<skipHours>Optional. Specifies the hours to ignore feed updates.
<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 this feed is updated from the feed source.
<webMaster>Optional. Defines the email address of the web administrator of this feed.