How to Create XML for an RSS Feed

XML in the RSS Feed

Really Simple Syndication (RSS) provides both professional and novices a way to market their sites. Many people associate an RSS feed with news because sweeping news agencies use RSS to provide updates. The truth is RSS works for any website that continually changes or adds new content. Applications that feed RSS utilize 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

If you wanted to create an RSS feed that highlighted XML articles on About.com, the code would look like this:

<title> XML Articles from About.com </title>
<description> Exciting new offerings from the world of XML and About.com </description>
<link>http://webdesign.about.com/od/xml-articles-by-darla-ferrara/XML_Articles_by_Darla_Ferrara.htm</link>

Item Tag

RSS uses some specific elements to distinguish itself. One entry is the <item> tag.

<item>
<title> XML Articles from About.com </title>
<description> Exciting new offerings from the world of XML and About.com </description>
<link>http://webdesign.about.com/od/xml-articles-by-darla-ferrara/XML_Articles_by_Darla_Ferrara.htm</link>
</item>

The elements for every page listed in the feed nests within a <item> tag. RSS allows you to showcase more than one content page at a time.

<item>
<title> XML Articles from About.com </title>
<description> Exciting new offerings from the world of XML and About.com </description>
<link>http://webdesign.about.com/od/xml-articles-by-darla-ferrara/XML_Articles_by_Darla_Ferrara.htm</link>
</item>

<item>
<title> About.com: Web Design/HTML </title>
<description> Keep up-to-date on all the tips and tricks in web design with About.com</description>
<link>http://webdesign.about.com/</link>
</item>

Channel Tag

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

<channel>
<item>
<title> XML Articles from About.com </title>
<description> Exciting new offerings from the world of XML and About.com </description>
<link>http://webdesign.about.com/od/xml-articles-by-darla-ferrara/XML_Articles_by_Darla_Ferrara.htm</link>
</item>

<item>
<title> About.com: Web Design/HTML </title>
<description> Keep up-to-date on all the tips and tricks in web design with About.com</description>
<link>http://webdesign.about.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 current feeds, that will probably be 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' extension and upload it to the aggregator of your choice.

<?xml version= "1.0"?>

<rss version= "2.0">
<channel>
<item>
<title> XML Articles from About.com </title>
<description> Exciting new offerings from the world of XML and About.com </description>
<link>http://webdesign.about.com/od/xml-articles-by-darla-ferrara/XML_Articles_by_Darla_Ferrara.htm</link>
</item>

<item>
<title> About.com: Web Design/HTML </title>
<description> Keep up-to-date on all the tips and tricks in web design with About.com</description>
<link>http://webdesign.about.com/</link>
</item>
</channel>
</rss>