Easy Tutorial
❮ Rss Tag Guid Rss Tag Category Channel ❯

RSS Syntax


The syntax of RSS 2.0 is simple and strict.


How RSS Works

RSS is used to share information between websites.

With RSS, you register your content with a company called an aggregator.

One of the steps is to create an RSS document and then save it with a .xml suffix. Then upload this file to your website. Next, register it with an RSS aggregator. Every day, the aggregator searches the registered websites for RSS documents, verifies their links, and displays information about the feed, so customers can link to the documents that interest them.

The section RSS Publishing explores free RSS aggregator services.


RSS Example

RSS documents use a simple, self-descriptive syntax.

Let's look at a simple 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>
  <item>
    <title>XML Tutorial</title>
    <link>http://www.tutorialpro.org/xml</link>
    <description>tutorialpro.org XML Tutorial</description>
  </item>
</channel>

</rss>

The first line of the document: the XML declaration - defines the XML version and character encoding used in the document. This example adheres to the 1.0 specification and uses the UTF-8 character set (supports Chinese).

The next line is the RSS declaration that identifies this document as an RSS document (this example is RSS version 2.0).

The next line contains the <channel> element. This element is used to describe the RSS feed.

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

Each <channel> element can have one or more <item> elements.

Each <item> element defines an article or "story" in the RSS feed.

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

Finally, the last two lines close the <channel> and <rss> elements.


Comments in RSS

The syntax for writing comments in RSS is similar to that in HTML:

<!-- This is an RSS comment -->

RSS is Written in XML

Because RSS is also XML, remember:

❮ Rss Tag Guid Rss Tag Category Channel ❯