Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

RSS Syntax

RSS Syntax


The syntax of RSS 2.0 is very simple and very 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 save it with the .xml extension. Then upload this file to your website. Next, register with an RSS aggregator. Every day, the aggregator visits registered websites to search for RSS documents, verify their links, and display information about the feeds, so that customers can link to documents that interest them.

Tip: Please see the RSS Publishing section to browse free RSS aggregator services.


RSS Examples

RSS documents use a simple, self-describing syntax.

Let's look at a simple RSS document:











  Runoob Tutorial首页

  http://www.runoob.com

  免费编程教程

  

    RSS 教程

    http://www.runoob.com/rss

    Runoob Tutorial Rss 教程

  

  

    XML 教程

    http://www.runoob.com/xml

    Runoob Tutorial XML 教程

  







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

The next line is the RSS declaration identifying this document as an RSS document (in this case RSS version 2.0).

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

element has three required child elements:

Each element can have one or more .

Each The element defines an article or "story" in an RSS feed.

element has three required child elements:

Finally, the next two lines close the and .


Comments in RSS

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






RSS is written using XML

Because RSS is also XML, remember: