An Atom Entry Element is at the center of both Atom Syndication and the
Atom Publishing Protocol. A single Atom Entry has the flexability to
carry with it both descriptive metadata and a payload in a simple
XML package. Here is a simple spec for what the <entry> tag can have:
An
<id>tag - a unique identifier like a URLAn
<updated>tag - a recently updated timestampA
<title>tag - a human readable title0 or more
<author>tags - to indicate the entry's authors0 or more
<contributor>tags - similiar to authors0 or more
<category>tags - to convey more information like tags0 or more
<link>tags - for other resources/URLsAn optional
<content>tag - the real dataAnd optional
<published>,<rights>,<source>, and<summary>tags for extra information and details about the entry.
The power is in the <content> tag. This tag has a type
attribute which can be text, html, xhtml, or
any valid MIME media type such as "image/jpeg" for jpeg images, "video/quicktime"
for mov movies etc. Here is a list of valid MIME types.
Without further ado, here are your example Atom entries:
<entry> <title>Robots Run Amok</title> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <link rel="self" title="Blog Post" href="http://example.org/2008/03/15/atom03" /> <summary>Some Robots are Crazy.</summary> </entry>
Nothing is really exciting about this Atom Entry. You get a feel
for what it is but you don't know the main content of the blog
article that this entry is seemingly referring to. An Atom Entry
this vague would be likely to show up in a very basic Atom Feed.
Since a Feed contains a collection of entries it may benefit the
syndicator to only give some information about each entry and allow
the user to request more by following the <link rel="self" href="...">
link for the full content. Lets do just that!
<entry> <title>Robots Run Amok</title> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <link rel="self" title="Blog Post" href="http://example.org/2008/03/15/atom03"/> <link rel="edit" href="http://example.org/e/2008/03/15/atom03/"/> <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/> <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/> <author> <name>Joseph Pecoraro</name> <uri>http://bogojoker.com/</uri> <email>j0e@example.com</email> </author> <contributor> <name>Sam Ruby</name> </contributor> <contributor> <name>Joe Gregorio</name> </contributor> <summary>Some Robots are Crazy.</summary> <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/"> <div xmlns="http://www.w3.org/1999/xhtml"> <p> I have not been in contact with too many robots. I am not <em>robo-phobic</em>, I just don't see them all that often. That may have been the source of today's problem! </p> <blockquote cite="Joseph Pecoraro"> I think a Robot robbed me today. It was crazy. </blockquote> <p> So what can I do? Who do I turn to? Help me. </p> </div> </content> </entry>
Now we really get a better idea of what this entry represents! We not only see the content but more metadata and even some links. Lets break it down:
The 3 required tags are at the top and serve their purpose
-
There are 4 links. Each with a descriptive
relattribute and anhrefattribute with a URL. These links are fundamental to Atom. In the case above they are descriptive enough that the unnecessarytitleattribute was dropped. One at a time:rel="self"is a link to the current entry, quite useful in practicerel="edit"is the URL used to edit this entry via the Atom Publishing Protocolrel="alternate"is a link to more external contentrel="enclosure"is a link to some extra "attached" content
There is 1 Author, Joseph Pecoraro, with his full contact information. There are also 2 contributors
The entry provides a summary of the content
-
The content itself is
type="xhtml". Therefore all of the data between the opening and closing<content>tags is xhtml. Sure enough the<div>links to the xhtml namespace! Joseph Pecoraro sure can write a great article!
For more information go on to read the RESTful page describing how the Atom Publshing Protocol combines Atom Entries and the HTTP Protocol to complete its goal of both simple syndication and flexible publication.