RSS <item>
Element
Each <item>
element defines an article or "story" in the RSS feed.
<item>
Element
Consider the following RSS document:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>tutorialpro.org Homepage</title>
<link>http://www.tutorialpro.org</link>
<description>Free Programming Tutorials</description>
<item>
<title>RSS Tutorial</title>
<link>http://www.tutorialpro.org/rss</link>
<description>tutorialpro.org RSS Tutorial</description>
</item>
</channel>
</rss>
As mentioned earlier, each <item>
element defines an article or "story" in the RSS feed.
The <item>
element has three required child elements:
<title>
- Defines the title of the item. (e.g., RSS Tutorial)<link>
- Defines the hyperlink to the item. (e.g., http://www.tutorialpro.org/rss)<description>
- Describes the item. (e.g., tutorialpro.org RSS Tutorial)
Additionally, there are several optional child elements of <item>
, some of which are introduced below.
<author>
Element
The <author>
child element is used to specify the email address of the item's author.
In the above RSS document, the author of the item might be:
<author>[email protected]</author>
<comments>
Element
The <comments>
child element allows linking an item to comments about that item.
In the above RSS document, the comments for the item might be:
<comments>http://www.tutorialpro.org/comments</comments>
<enclosure>
Element
The <enclosure>
child element allows embedding a media file into an item.
The <enclosure>
element has three required attributes:
url
- Defines the URL pointing to the media filelength
- Defines the length of the media file in bytestype
- Defines the type of the media file
In the above RSS document, the media file included in the item might be:
<enclosure url="http://www.tutorialpro.org/rss/rss.mp3"
length="5000" type="audio/mpeg" />
RSS <item>
Reference Manual
Element | Description |
---|---|
<author> | Optional. Specifies the email address of the item's author. |
<category> | Optional. Defines one or more categories the item belongs to. |
<comments> | Optional. Allows linking the item to comments about that item. |
<description> | Required. Describes the item. |
<enclosure> | Optional. Allows embedding a media file into an item. |
<guid> | Optional. Defines a unique identifier for the item. |
<link> | Required. Defines the hyperlink to the item. |
<pubDate> | Optional. Defines the last publication date of the item. |
<source> | Optional. Specifies a third-party source for the item. |
<title> | Required. Defines the title of the item. |