Atom feeds are simply a collection of entries. The simplicity of Atom feeds is one of the things that makes Atom so great. But, by making use of XML extensibility, Atom feeds are much more powerful then their predecessor... RSS feeds. Atom Feeds can handle complex content and yet remain very simple and elegant on their own. They are not limited to just text, they may contain images, video, text, html, and more all at once!
Take a look at this Feed skeleton. The example is broken down into detail down below, showing both simple and more advanced concepts of a Feed for a fake blog.
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <!-- Feed Details --> <title type="text>Blog Title</title> <author> ... </author> <!-- First Entry --> <entry> ... </entry> <!-- Second Entry --> <entry> ... </entry> </feed>
For Atom feeds the root most element is the
tag. That tag points to the
namespace. This is one of the most important parts of an Atom feed
and XML in general. By defining multiple
namespaces you can use tags from different namespaces within
your Atom Feed thereby extending Atom for enhanced functionality.
I suggest that you take a look at the
Atom Syndication Format specification to learn more about the individual tags
in more detail. The most common tags are
<link>, and probably most importantly the
<entry> tag, which may itself incorporate all of the
previously mentioned tags!
Inside an Atom Feed, before any
<entry> tags, will
be a bunch of data that describe the feed itself. This is metadata describing
the feed and is meant to be human readable and straightforward. It is simple
to understand and implement. The Atom Syndication Specification states that
this area must contain the following:
<id>tag - a unique identifier like a URL
<updated>tag - a recently updated timestamp
<title>tag - a human readable title
0 or more
<author>tags - to indicate the feeds authors
0 or more
<contributor>tags - similar to authors
0 or more
<category>tags - to convey some information
0 or more
<link>tags - for other resources/URLs
<subtitle>tags for extra information and details for the feed.
Each element is explained in detail under the atom:feed tag's documentation. Here is an example for a fake blog. Remember the required items are green and optional items are blue.
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <!-- Feed Details --> <title type="text">Overused Moleskin</title> <updated>2008-03-05T12:29:29Z</updated> <id>tag:example.org,2003:3</id> <link rel="alternate" type="text/html" href="http://example.org/"/> <link rel="self" type="application/atom+xml" href="http://example.org/feed.atom"/> <subtitle type="html"> My <em>short</em> stories. </subtitle> <rights>Copyright (c) 2008, Joseph Pecoraro</rights> <author> <name>Joseph Pecoraro</name> </author>
The blog is titled
It is found at
Was last updated
Written and copyrighted by
It likely contains Joe's
There is really nothing to it! Everything is human readable. You can
see in the
<subtitle> tag that its inner content
can be defined in a number of extensible ways. In the case of the
<subtitle> tag its values can be "Text Content" meaning
xhtml, but you will
see later with the
element, the data can be far different.
A feed is not complete without
Go ahead to the next page for information regarding this key