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

RSS <item> element



Each <item> element defines 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>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, each <item> element defines an RSS feed An article or story in ". The

<item> element has three required child elements:

  • <title> - Defines the title of the item. (For example, RSS tutorial)

  • <link> - Define the hyperlink to the item (for example, http://www.w3cschool.cc/rss)

  • #.
  • ##<description> - Describe this item (such as w3school's RSS tutorial)

In addition, there are several optional sub-elements of <item>, we will The most important ones are introduced below. The


<author> element

<author> sub-element is used to specify the email address of the author of a project

.

Note: To prevent spam, some developers will not use the <author> element

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

<. ;author>hege@refsnesdata.no</author>

##<comments> Element

<comments> child elements allow linking an item to Comments about this item.

Comments for the item in the RSS document above may look like this:

##<comments>http://www.w3schools.com/comments</ comments>



<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, Media files included in the project might look like this:

<enclosure url="http://www.w3schools.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. Define one or more categories to which the item belongs. <comments>Optional. Allows projects to connect to comments (files) about this project. <description>Required. Describe this project. <enclosure> Optional. Allows importing a media file into an item. <guid> Optional. Define a unique identifier for the project. <link>Required. Defines a hyperlink to this item. <pubDate>Optional. Defines the last release date for this project. <source>Optional. Designate a third-party source for this project. <title>Required. Defines the title of this project.