RSS <item> Element
- Previous Page RSS <channel>
- Next Page Publish Feed with RSS
Each <item> element can define an article or "story" in the RSS feed.
<item> element
Please see the following RSS document:
<?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>
As mentioned earlier, each <item> element can define 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 reach the item. (e.g., http://www.codew3c.com/rss)
- <description> - Describes this item (e.g., CodeW3C's RSS tutorial)
In addition, there are several optional child elements of <item>, which we will introduce the most important ones below.
The <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 may not use this <author> element.
The author of the items in the above RSS document may be:
<author>service@codew3c.com</author>
The <comments> element
The <comments> child element allows linking a project to comments related to it.
The comments in the items of the above RSS document may look like this:
<comments>http://www.codew3c.com/comments</comments>
The <enclosure> element
The <enclosure> child element allows importing a media file 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 above RSS document, the media files included in the items may look like this:
<enclosure url="http://www.codew3c.com/rss/rss.mp3" length="5000" type="audio/mpeg" />
RSS <item> Reference Manual
Element | Description |
---|---|
<author> | Optional. Specifies the email address of the project author. |
<category> | Optional. Defines one or more categories to which this project belongs. |
<comments> | Optional. Allows an item to link to comments (files) related to this project. |
<description> | Required. Describes this project. |
<enclosure> | Optional. Allows importing a media file into an item. |
<guid> | Optional. Defines a unique identifier for this project. |
<link> | Required. Defines the hyperlink pointing to this project. |
<pubDate> | Optional. Defines the last published date of this project. |
<source> | Optional. Specifies a third-party source for this project. |
<title> | Required. Defines the title of this project. |
- Previous Page RSS <channel>
- Next Page Publish Feed with RSS