Elemento <item> de RSS

Cada elemento <item> puede definir un artículo o "story" en el feed RSS.

Elemento <item>

Por favor, vea el siguiente documento RSS:

<?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 an RSS feed.

The <item> element has three required sub-elements:

  • <title> - Define the title of the project (for example, RSS Tutorial)
  • <link> - Define the hyperlink to the project (for example, http://www.codew3c.com/rss)
  • <description> - Describe this project (for example, CodeW3C's RSS tutorial)

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

The <author> element

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

Note:To prevent spam, some developers do 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> sub-element allows connecting 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> sub-element allows importing a media file into an item.

The <enclosure> element has three required attributes:

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

En el documento RSS superior, los archivos de medios incluidos en el proyecto pueden ser como estos:

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

Manual de referencia del <item> RSS

Elemento Descripción
<author> Opcional. Especifica la dirección de correo electrónico del autor del proyecto.
<category> Opcional. Define una o más categorías a las que pertenece el proyecto.
<comments> Opcional. Permite que el proyecto se conecte a comentarios (archivos) relacionados con él.
<description> Obligatorio. Describe este proyecto.
<enclosure> Opcional. Permite importar un archivo de medios a un elemento.
<guid> Opcional. Define un identificador único para el proyecto.
<link> Obligatorio. Define el vínculo al proyecto.
<pubDate> Opcional. Define la fecha de última publicación de este proyecto.
<source> Opcional. Especifica una fuente tercero para este proyecto.
<title> Obligatorio. Define el título de este proyecto.