How to Create an XML Feed

Make your own RSS feed with this XML guide

Keyboard with orange rss key.
pixelfit / Getty Images

Really Simple Syndication (RSS) provides both professionals and novices a way to market their websites. While it's easy to associate an RSS feed with news agencies only, the truth is that RSS works for any website that continually changes or adds new content.

Applications that feed RSS use the XML structure to deliver data. Creating an XML document to promote your blog or pages via an RSS feed is something that anyone with a basic understanding of XML can do.

Set Up the Elements

A few elements are standard for an RSS feed:

  • Title
  • Description
  • Link

For example, if you wanted to create an RSS feed that highlighted Web Design content on your website, you would need elements like the:

<title> XML Articles from [Your Website] </title>
<description> Exciting new offerings from the world of XML and [Your Website] </description>
<link>http://yourwebsite.com/xml-articles.htm</link>

Item Tag

RSS uses some specific elements to distinguish itself. One entry is the <item> tag, which in the present example, is used as follows:

<item>
<title> XML Articles from [Your Website] </title>
<description> Exciting new offerings from the world of XML and [Your Website] </description>
<link>http://yourwebsite.com/xml-articles.htm</link>
</item>

The elements for every page listed in the feed nest within the <item> tag. RSS allows you to showcase more than one content page at a time by providing a new "item" set, like this:

<item>
<title> XML Articles from [Your Website] </title>
<description> Exciting new offerings from the world of XML and [Your Website] </description>
<link>http://youwebsite.com/xml-articles.htm</link>
</item>
<item>
<title> Web Design/HTML by [Your Website] </title>
<description> Keep up-to-date on all the tips and tricks in web design with yourwebsite.com</description>
<link>http://yourwebsite.com/</link>
</item>

Channel Tag

An RSS reader, or news aggregator, must hash out a lot of information in a short period. To accomplish this task, they separate the files into channels. Just like channels on a TV, this tag divides each feed.

You can implement channels with the opening tag and closing tag. Use them to contain the tag, as follows:

<channel>
<item>
<title> XML Articles from [Your Website] </title>
<description> Exciting new offerings from the world of XML and [Your Website] </description>
<link>http://youwebsite.com/xml-articles.htm</link>
</item>
<item>
<title> Web Design/HTML by [Your Website] </title>
<description> Keep up-to-date on all the tips and tricks in web design with yourwebsite.com</description>
<link>http://yourwebsite.com/</link>
</item>
</channel>

XML Declaration and RSS Version

All XML documents must have an opening declaration statement:

<?xml version= "1.0"?>

Additionally, XML created for an RSS feed must use <rss> as the root element and list the version (in the example below, we're using "2.0"). You should look through the documentation provided by your RSS reader and use the version required by the site.

<rss version= "2.0"> </rss> 

Once you complete the XML code, save the document using the .XML file extension and upload it to the aggregator of your choice.

Here's an example of what our sample RSS feed might look like:

<?xml version= "1.0"?>
<rss version= "2.0">
<channel>
<item>
<title> XML Articles from [Your Website] </title>
<description> Exciting new offerings from the world of XML and [Your Website] </description>
<link>http://youwebsite.com/xml-articles.htm</link>
</item>
<item>
<title> Web Design/HTML by [Your Website] </title>
<description> Keep up-to-date on all the tips and tricks in web design with yourwebsite.com</description>
<link>http://yourwebsite.com/</link>
</item>
</channel>
</rss>
Was this page helpful?