How to Create XML for an RSS Feed

RSS feeds promote discoverability of your online content

Keyboard with orange rss key

pixelfit/Getty Images

Really Simple Syndication provides both professionals and novices an excellent way to market their websites. While it's easy to associate an RSS feed exclusively with news agencies, 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 web pages through an RSS feed is something that anyone with a basic understanding of XML can do.

Most content-management systems, including WordPress, generate RSS for you.

Set Up the Elements

A few elements are standard for an RSS feed:

  • Title
  • Description
  • Link

To create an RSS feed that highlights 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 using the channel tag. Just like channels on a TV, this tag divides each feed.

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 incorporate 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"). Review the documentation provided by your RSS reader and use the version required by the site.

After 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 your 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>