Latest web development tutorials

RSS Grammar

RSS 2.0 syntax is very simple, and very strict. / P>


How does RSS work

RSS is used to share information between sites.

With RSS, you register your company name in the content aggregator.

One step is to create an RSS document, and then use the .xml extension to save it. This file is then uploaded to your website. Next, to register via an RSS aggregator. Every day, aggregators will be registered to the site search RSS documents, verifies the link, and displays information about the feed, so that customers can link to make them interested in the document.

Tip: Please publish RSS chapter to view free RSS aggregation services.


Examples of RSS

RSS documents use a simple self-described syntax.

Let's look at a simple 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>
<item>
<title>XML Tutorial</title>
<link>http://www.w3schools.com/xml</link>
<description>New XML tutorial on W3Schools</description>
</item>
</channel>

</rss>

The first line in the document: XML declaration - defines the XML version and the character encoding used in the document. This example conforms to the 1.0 specification, and use the ISO-8859-1 (Latin-1 / West European) character set.

The next line is the identity of this document is a declaration RSS RSS document (in this case is the RSS version 2.0).

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

<Channel> element has three required child elements:

  • <Title> - Defines the title of the channel. (Eg w3school Home)
  • <Link> - Hyperlink definitions arrive channel. (Eg www.w3school.com.cn)
  • <Description> - description of this channel (such as the free website building tutorials)

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

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

<Item> element has three required child elements:

  • <Title> - Defines the title of the project. (Eg RSS Tutorial)
  • <Link> - Hyperlink definitions arrive project. (Eg http://www.w3school.com.cn/rss)
  • <Description> - description of the project (such as w3school the RSS tutorial)

Finally, two rows behind closed <channel> and <rss> element.


Comments in RSS

Write notes in the RSS and HTML syntax similar to the syntax:

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


RSS uses XML to write

Because RSS is XML, keep in mind:

  • All elements must have a closing tag Xu
  • Elements are case sensitive
  • Required elements are properly nested
  • Attribute values ​​must be quoted