RSS <item>Element


Each <item> element can define an article or "story" in an RSS feed.


<item> 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, each <item> element can define an article or "story" in an RSS feed.

The <item> element has three required child elements:

  • <title> - Defines the title of the item. (For example, RSS Tutorial)
  • <link> - Defines the hyperlink to the item. (For example, http://www.example.com/rss)
  • <description> - Describes this item (For example, Example Tutorial RSS Tutorial)

In addition, there are several optional child elements of <item>, and we will introduce the most important ones below.


<author> Element

The <author> child element is used to specify the email address of the author of an item.

Note:To prevent spam, some developers do not use this <author> element.

The author of the item in the RSS document above might be:

<author>[email protected]</author>


<comments> Element

The <comments> child element allows an item to be linked to comments about this item.

The comments for the item in the RSS document above might look like this:

<comments>http://www.example.com/comments</comments>


<enclosure> Element

The <enclosure> child element allows a media file to be imported into an item.

The <enclosure> element has three required attributes:

  • url - Defines the URL pointing to this media file
  • length - Defines the length of this media file (in bytes)
  • type - Defines the type of the media file

In the RSS document above, the media file included in the item might look like this:

<enclosure url="http://www.example.com/rss/rss.mp3"
length="5000" type="audio/mpeg" />


RSS <item> Reference Manual

Element Description
<author> Optional. Specifies the email address of the author of the item.
<category> Optional. Defines one or more categories to which the item belongs.
<comments> Optional. Allows the item to be linked to comments (files) about this item.
<description> Required. Describes this item.
<enclosure> Optional. Allows a media file to be imported into an item.
<guid> Optional. Defines a unique identifier for the item.
<link> Required. Defines the hyperlink pointing to this item.
<pubDate> Optional. Defines the last publication date of this item.
<source> Optional. Specifies a third-party source for this item.
<title> Required. Defines the title of this item.
Other Extensions