Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

XML Tutorial

XML HOME XML Introduction XML How to use XML Tree XML Syntax XML Elements XML Attributes XML Namespaces XML Display XML HttpRequest XML Parser XML DOM XML XPath XML XSLT XML XQuery XML XLink XML Validator XML DTD XML Schema XML Server XML Examples XML Quiz XML Certificate

XML AJAX

AJAX Introduction AJAX XMLHttp AJAX Request AJAX Response AJAX XML File AJAX PHP AJAX ASP AJAX Database AJAX Applications AJAX Examples

XML DOM

DOM Introduction DOM Nodes DOM Accessing DOM Node Info DOM Node List DOM Traversing DOM Navigating DOM Get Values DOM Change Nodes DOM Remove Nodes DOM Replace Nodes DOM Create Nodes DOM Add Nodes DOM Clone Nodes DOM Examples

XPath Tutorial

XPath Introduction XPath Nodes XPath Syntax XPath Axes XPath Operators XPath Examples

XSLT Tutorial

XSLT Introduction XSL Languages XSLT Transform XSLT <template> XSLT <value-of> XSLT <for-each> XSLT <sort> XSLT <if> XSLT <choose> XSLT Apply XSLT on the Client XSLT on the Server XSLT Edit XML XSLT Examples

XQuery Tutorial

XQuery Introduction XQuery Example XQuery FLWOR XQuery HTML XQuery Terms XQuery Syntax XQuery Add XQuery Select XQuery Functions

XML DTD

DTD Introduction DTD Building Blocks DTD Elements DTD Attributes DTD Elements vs Attr DTD Entities DTD Examples

XSD Schema

XSD Introduction XSD How To XSD <schema> XSD Elements XSD Attributes XSD Restrictions XSD Complex Elements XSD Empty XSD Elements-only XSD Text-only XSD Mixed XSD Indicators XSD <any> XSD <anyAttribute> XSD Substitution XSD Example

XSD Data Types

XSD String XSD Date/Time XSD Numeric XSD Misc XSD Reference

Web Services

XML Services XML WSDL XML SOAP XML RDF XML RSS

References

DOM Node Types DOM Node DOM NodeList DOM NamedNodeMap DOM Document DOM Element DOM Attribute DOM Text DOM CDATA DOM Comment DOM XMLHttpRequest DOM Parser XSLT Elements XSLT/XPath Functions

XML RSS


With RSS it is possible to distribute up-to-date web content from one web site to thousands of other web sites around the world.

RSS allows fast browsing for news and updates.


RSS Document Example

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

<channel>
  <title>W3Schools Home Page</title>
  <link>https://www.w3schools.com</link>
  <description>Free web building tutorials</description>
  <item>
    <title>RSS Tutorial</title>
    <link>https://www.w3schools.com/xml/xml_rss.asp</link>
    <description>New RSS tutorial on W3Schools</description>
  </item>
  <item>
    <title>XML Tutorial</title>
    <link>https://www.w3schools.com/xml</link>
    <description>New XML tutorial on W3Schools</description>
  </item>
</channel>

</rss>

What is RSS?

  • RSS stands for Really Simple Syndication
  • RSS allows you to syndicate your site content
  • RSS defines an easy way to share and view headlines and content
  • RSS files can be automatically updated
  • RSS allows personalized views for different sites
  • RSS is written in XML

Why use RSS?

RSS was designed to show selected data.

Without RSS, users will have to check your site daily for new updates. This may be too time-consuming for many users. With an RSS feed (RSS is often called a News feed or RSS feed) they can check your site faster using an RSS aggregator (a site or program that gathers and sorts out RSS feeds).

Since RSS data is small and fast-loading, it can easily be used with services like cell phones or PDA's.

Web-rings with similar information can easily share data on their web sites to make them better and more useful.



Who Should use RSS?

Webmasters who seldom update their web sites do not need RSS!

RSS is useful for web sites that are updated frequently, like:

  • News sites - Lists news with title, date and descriptions
  • Companies - Lists news and new products
  • Calendars - Lists upcoming events and important days
  • Site changes - Lists changed pages or new pages

Benefits of RSS

Here are some benefits of using RSS:

Choose your news
With RSS you can choose to view the news you want, the news that interest you and are relevant to your work.

Remove unwanted information
With RSS you can (finally) separate wanted information from unwanted information (spam)!

Increase your site traffic
With RSS you can create your own news channel, and publish it to the Internet!


The History of RSS

  • 1997 - Dave Winer at UserLand develops scriptingNews. RSS was born
  • 1999 - Netscape develops RSS 0.90 (which supported scriptingNews)
  • 1999 - Dave Winer develops scriptingNews 2.0b1 (which included RSS 0.90 features)
  • 1999 - Netscape develops RSS 0.91 (which included most features from scriptingNews 2.0b1)
  • 1999 - UserLand gets rid of scriptingNews and uses only RSS 0.91
  • 1999 - Netscape stops their RSS development
  • 2000 - UserLand releases the official RSS 0.91 specification
  • 2000 - O'Reilly develops RSS 1.0. This format uses RDF and namespaces.
  • 2000 - Dave Winer at UserLand develops RSS 0.92
  • 2002 - Dave Winer develops RSS 2.0 after leaving UserLand
  • 2003 - The official RSS 2.0 specification is released

RSS 1.0 is the only version that was developed using the W3C RDF (Resource Description Framework) standard.

The idea behind RDF was to help create a Semantic Web. However, this does not matter too much for ordinary users, but by using web standards it will be easier for persons and applications to exchange data.


What RSS Version Should I Use?

RSS 0.91 and RSS 2.0 are easier to understand than RSS 1.0. Our tutorial is based on RSS 2.0.

The syntax rules of RSS 2.0 are very simple and very strict.


Is RSS a Web Standard?

There is no official standard for RSS.

  • About 50 % of all RSS feeds use RSS 0.91
  • About 25 % use RSS 1.0
  • The last 25 % is split between RSS 0.9x versions and RSS 2.0

How RSS Works

RSS is used to share content between websites.

With RSS, you register your content with companies called aggregators.

So, to be a part of it: First, create an RSS document and save it with an .xml extension. Then, upload the file to your website. Next, register with an RSS aggregator. Each day the aggregator searches the registered websites for RSS documents, verifies the link, and displays information about the feed so clients can link to documents that interests them.

Tip: Read our RSS Publishing chapter to view free RSS aggregation services.


RSS Example

RSS documents use a self-describing and simple syntax.

Here is a simple RSS document:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

<channel>
  <title>W3Schools Home Page</title>
  <link>https://www.w3schools.com</link>
  <description>Free web building tutorials</description>
  <item>
    <title>RSS Tutorial</title>
    <link>https://www.w3schools.com/xml/xml_rss.asp</link>
    <description>New RSS tutorial on W3Schools</description>
  </item>
  <item>
    <title>XML Tutorial</title>
    <link>https://www.w3schools.com/xml</link>
    <description>New XML tutorial on W3Schools</description>
  </item>
</channel>

</rss>

The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document. In this case the document conforms to the 1.0 specification of XML and uses the UTF-8 character set.

The next line is the RSS declaration which identifies that this is an RSS document (in this case, 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 child elements:

  • <title> - Defines the title of the channel (e.g. W3Schools Home Page)
  • <link> - Defines the hyperlink to the channel (e.g. https://www.w3schools.com)
  • <description> - Describes the channel (e.g. Free web building tutorials)

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 child elements:

  • <title> - Defines the title of the item (e.g. RSS Tutorial)
  • <link> - Defines the hyperlink to the item (e.g. https://www.w3schools.com/xml/xml_rss.asp)
  • <description> - Describes the item (e.g. New RSS tutorial on W3Schools)

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


Comments in RSS

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

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

RSS is Written in XML

Because RSS is XML, keep in mind that:

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

The RSS <channel> Element

The RSS <channel> element describes the RSS feed.

Look at the following RSS document:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

<channel>
  <title>W3Schools Home Page</title>
  <link>https://www.w3schools.com</link>
  <description>Free web building tutorials</description>
  <item>
    <title>RSS Tutorial</title>
    <link>https://www.w3schools.com/xml/xml_rss.asp</link>
    <description>New RSS tutorial on W3Schools</description>
  </item>
</channel>

</rss>

As mentioned before, the <channel> element describes the RSS feed, and has three required child elements:

  • <title> - Defines the title of the channel (e.g. W3Schools Home Page)
  • <link> - Defines the hyperlink to the channel (e.g. https://www.w3schools.com)
  • <description> - Describes the channel (e.g. Free web building tutorials)

The <channel> element usually contains one or more <item> elements. Each <item> element defines an article or "story" in the RSS feed.

Furthermore, there are several optional child elements of <channel>. We will explain the most important ones below.


The <category> Element

The <category> child element is used to specify a category for your feed.

The <category> element makes it possible for RSS aggregators to group sites based on category.

The category for the RSS document above could be:

<category>Web development</category>

The <copyright> Element

The <copyright> child element notifies about copyrighted material.

The copyright for the RSS document above could be:

<copyright>2006 Refsnes Data as. All rights reserved.</copyright>

The <image> Element

The <image> child element allows an image to be displayed when aggregators present a feed.

The <image> element has three required child elements:

  • <url> - Defines the URL to the image
  • <title> - Defines the text to display if the image could not be shown
  • <link> - Defines the hyperlink to the website that offers the channel

The image for the RSS document above could be:

<image>
  <url>https://www.w3schools.com/images/logo.gif</url>
  <title>W3Schools.com</title>
  <link>https://www.w3schools.com</link>
</image>

The <language> Element

The <language> child element is used to specify the language used to write your document.

The <language> element makes it possible for RSS aggregators to group sites based on language.

The language for the RSS document above could be:

<language>en-us</language>

The <item> Element

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

Look at the following RSS document:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

<channel>
  <title>W3Schools Home Page</title>
  <link>https://www.w3schools.com</link>
  <description>Free web building tutorials</description>
  <item>
    <title>RSS Tutorial</title>
    <link>https://www.w3schools.com/xml/xml_rss.asp</link>
    <description>New RSS tutorial on W3Schools</description>
  </item>
</channel>

</rss>

As mentioned before, each <item> element defines an article or "story" in the RSS feed.

The <item> element has three required child elements:

  • <title> - Defines the title of the item (e.g. RSS Tutorial)
  • <link> - Defines the hyperlink to the item (e.g. https://www.w3schools.com/xml/xml_rss.asp)
  • <description> - Describes the item (e.g. New RSS tutorial on W3Schools)

Furthermore, there are several optional child elements of <item>. We will explain the most important ones below.


The <author> Element

The <author> child element is used to specify the e-mail address of the author of an item.

Note: To prevent spam e-mails, some developers do not include the <author> element.

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

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

The <comments> Element

The <comments> child element allows an item to link to comments about that item.

A comment of the item in the RSS document above could be:

<comments>https://www.w3schools.com/comments</comments>

The <enclosure> Element

The <enclosure> child element allows a media-file to be included with an item.

The <enclosure> element has three required attributes:

  • url - Defines the URL to the media file
  • length - Defines the length (in bytes) of the media file
  • type - Defines the type of media file

A media-file included in the item in the RSS document above could be:

<enclosure url="https://www.w3schools.com/xml/rss.mp3"
length="5000" type="audio/mpeg" />

Get Your RSS Feed Up On The Web

Having an RSS document is not useful if other people cannot reach it.

Now it's time to get your RSS file up on the web. Here are the steps:

1. Name your RSS file. Notice that the file must have an .xml extension.

2. Validate your RSS file

3. Upload the RSS file to your web directory on your web server.

4. Copy the little orange RSS Logo or XML Logo button to your web directory.

5. Put the little orange "RSS" or "XML" button on the page where you will offer RSS to the world (e.g. on your home page). Then add a link to the button that links to the RSS file. The code will look something like this:
<a href="https://www.w3schools.com/xml/myfirstrss.xml">
<img src="https://www.w3schools.com/xml/pic_rss.gif" width="36" height="14">
</a>.

6. Submit your RSS feed to the RSS Feed Directories (you can Google or Yahoo for "RSS Feed Directories"). Note! The URL to your feed is not your home page, it is the URL to your feed, like "https://www.w3schools.com/xml/myfirstrss.xml".

7. Register your feed with the major search engines:

8. Update your feed - After registering your RSS feed, you must make sure that you update your content frequently and that your RSS feed is constantly available.


Can I Manage my RSS Feed Myself?

The best way to ensure your RSS feed works the way you want, is to manage it yourself.

However, this can be very time consuming, especially for pages with lot of updates.

An alternative is to use a third-party automated RSS.


Automated RSS

For users who only need an RSS feed for their personal website, some of the most popular blog (Web Log) managers that offer built-in RSS services are:


RSS Readers

An RSS Reader is used to read RSS Feeds!

RSS readers are available for many different devices and OS.

There are a lot of different RSS readers. Some work as web services, and some are limited to windows (or Mac, PDA or UNIX):

  • QuiteRSS - An open-source, cross-platform RSS/Atom news feed reader
  • FeedReader - A simple, straightforward feed reader that easily handles large number of feeds

Tip: Most browsers have a built-in RSS Reader. If you go to a web site that offers RSS feeds, you will see an RSS icon RSS in the address bar, or toolbar. Click on the icon to view a list of the different feeds. Choose the feed you want to read.


I have an RSS Reader. Now what?

Click on the little RSS Logo or XML Logo button next to the RSS feed you want to read. Copy The URL you get in the browser window and paste it in your RSS reader.


RSS Reference

The <channel> Element

The links in the "Element" column point to more information about each specific element.

Element Description
<category> Optional. Defines one or more categories for the feed
<cloud> Optional. Register processes to be notified immediately of updates of the feed
<copyright> Optional. Notifies about copyrighted material
<description> Required. Describes the channel
<docs> Optional. Specifies a URL to the documentation of the format used in the feed
<generator> Optional. Specifies the program used to generate the feed
<image> Optional. Allows an image to be displayed when aggregators present a feed
<language> Optional. Specifies the language the feed is written in
<lastBuildDate> Optional. Defines the last-modified date of the content of the feed
<link> Required. Defines the hyperlink to the channel
<managingEditor> Optional. Defines the e-mail address to the editor of the content of the feed
<pubDate> Optional. Defines the last publication date for the content of the feed
<rating> Optional. The PICS rating of the feed
<skipDays> Optional. Specifies the days where aggregators should skip updating the feed
<skipHours> Optional. Specifies the hours where aggregators should skip updating the feed
<textInput> Optional. Specifies a text input field that should be displayed with the feed
<title> Required. Defines the title of the channel
<ttl> Optional. Specifies the number of minutes the feed can stay cached before refreshing it from the source
<webMaster> Optional. Defines the e-mail address to the webmaster of the feed

The <item> Element

Element Description
<author> Optional. Specifies the e-mail address to the author of the item
<category> Optional. Defines one or more categories the item belongs to
<comments> Optional. Allows an item to link to comments about that item
<description> Required. Describes the item
<enclosure> Optional. Allows a media file to be included with the item
<guid> Optional. Defines a unique identifier for the item
<link> Required. Defines the hyperlink to the item
<pubDate> Optional. Defines the last-publication date for the item
<source> Optional. Specifies a third-party source for the item
<title> Required. Defines the title of the item

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.