Secrets of RSS
Atom documents take a little more thought to create from scratch, because the Atom specification is more complicated (it's more than 50 pages long). Here are some of the differences between RSS 2.0 and Atom:
Here's our sample RSS document translated into a valid Atom 1.0 document. Note the different elements compared with those in an RSS 2.0 document. <?xml version="1.0"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title type="text">Steve's News</title> <subtitle type="html"> News from Steve </subtitle> <updated>2005-09-01T18:00:00Z</updated> <id>tag:example.org,2003:3</id> <link rel="alternate" type="text/html" hreflang="en" href="http://www.rssmaniac.com/steve"/> <link rel="self" type="application/atom+xml" href="http://www.rssmaniac.com/steve/news.xml"/> <rights>Copyright 2006.</rights> <entry> <title>Steve shovels the snow</title> <link rel="alternate" type="text/html" href="http://www.rssmaniac.com/steve"/> <link rel="enclosure" type="audio/mpeg" length="353566" href="http://rssmaniac.com/steve/snow.mp3"/> <id>tag:example.org,2003:3.2397</id> <updated>2005-09-01T18:00:00Z</updated> <published>2005-09-01T16:00:00Z</published> <author> <name>Steve</name> <uri>http://rssmaniac.com/steve</uri> <email>steve@rssmaniac.com</email> </author> <contributor> <name>Nancy</name> </contributor> <content type="xhtml" xml:lang="en" xml:base="http://rssmaniac.com/"> <div xmlns="http://www.w3.org/1999/xhtml"> It snowed once again. Time to shovel! </div> </content> </entry> </entry> </feed>
Atom feeds are somewhat more complex and longer than RSS 2.0 documents, but if you take a look at what's going on in our sample document, it should be understandableor at least familiar. |