Embedding Atom elements in your RSS 2.0 feed

by Andrew Grumet

Atom elements are highlighted in green. Click on the numbered bullets to read more about each highlighted element.

<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xmlns:atom="http://purl.org/atom/ns#"> This namespace declaration says that all elements prefixed with atom: are to be interpreted per the Atom specification.
    <channel>
        <title>Andrew Grumet's Weblog</title>
        <link>http://www.grumet.net/weblog/</link>
        <description>Weblogging, programming, Somerville, culture</description>
        <language>en-us</language>
        <copyright>Copyright 2004</copyright>
        <lastBuildDate>Sun, 20 Jun 2004 22:43:32 -0500</lastBuildDate>
        <pubDate>Sun, 20 Jun 2004 22:43:32 -0500</pubDate>
        <generator>http://www.movabletype.org/?v=2.661</generator>
        <docs>http://blogs.law.harvard.edu/tech/rss</docs> 
        <item>
            <atom:author> The atom:author element is an example of a Person construct.  The construct requires a human-readable name, but the email and url elements are optional.
                <atom:name>Andrew Grumet</atom:name>
                <atom:url>http://grumet.net/</atom:url>
                <atom:email>aegrumet@mit.edu</atom:email>
                </atom:author>
	    <description>Aaron Swartz takes a contrarian view of the "getting news from comedy shows is bad" meme:
                           "The Daily Show's staff consists mostly of comedians, not journalists. Yet they were able
                           to give this story the coverage that, as far as...
                           </description>
	    The atom:content element contains the full content of the entry.<atom:content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.grumet.net/weblog/">
	        <![CDATA[<p>Aaron Swartz takes a <a href="http://www.aaronsw.com/weblog/001347">contrarian view</a>
                of the "getting  news from comedy shows is bad" meme: "The Daily Show's staff consists mostly of comedians, not
                journalists. Yet they were able to give this story the coverage that, as far as I can tell, only one other news
                source (UPI) did. This is no one-time occurance. The Daily Show is routinely the most on-top-of-things source
                for news, while also being extremely entertaining."<br></p>]]>
	        </atom:content>
	    <link>http://grumet.net/weblog/archives/2004/06/20/000911.html</link>
	    <guid>http://grumet.net/weblog/archives/2004/06/20/000911.html</guid>
	    <pubDate>Sun, 20 Jun 2004 22:43:33 -0500</pubDate>
	    <atom:modified>2004-06-20T23:30:45Z</atom:modified> The atom:modified element is a W3C Date-Time string that indicates the time that the entry was last modified.
	    </item>
        </channel>
    </rss>

1 This namespace declaration says that all elements prefixed with atom: are to be interpreted per the Atom specification.

2 The atom:author element is an example of a Person construct. The construct requires a human-readable name, but the email and url elements are optional.

3 The atom:content element contains the full content of the entry. The mode="escaped" attribute indicates that payload of the content element is escaped text and must be unescaped by consuming code before further processing. Here we use an XML CDATA section to escape special characters like the less-than sign (<). CDATA sections begin with the string "<![CDATA[" and end with the string "]]>". The type="text/html" attribute indicates that the content, once processed according to the mode, is intended for viewing in an HTML browser.

4 The atom:modified element is a W3C Date-Time string that indicates the time that the entry was last modified.

Comment

aegrumet@alum.mit.edu