XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.

advertisement

What Is Atom
by Ben Hammersley | Pages: 1, 2

The Fundamental Changes

Although those interested in implementing the Atom Syndication Format within their own software are directed to read the original specification document, rather than this article, there are some technical things to note from this feed listing. First things first: an Atom feed is XML, naturally, and so must follow all the usual well-formedness rules that that implies. All the elements must be in the http:// www.w3.org/2005/Atom namespace, and are considered to be in plain text--specifically, entity-encoded html will be considered to be plain text. Dates must be in RFC 3339 format too. Ok? Right, let's look at the feed.

As you can see, a feed consists of some metadata about the feed, followed by one (or naturally more) entries. This metadata chunk contains, happily, all of the data we found missing from the default RSS 2.0 feeds. The id element provides the "where," giving the feed's URI. The title provides a "what," giving the title of the feed. updated gives the "when," with an obligation to say when the feed was last changed. author says "who" created the feed, and link provides the "how"--giving a link to an HTML version of the resource the feed represents.

As you can see here, this section of an Atom feed can also contain elements detailing categories, intellectual property rights, contributors' details, a feed's logo, and more.

The Entry Section

An Atom feed contains one or more entry sections. These are just like an RSS feed's item sections. The entry section, just like the feed's main metadata section, has the obligatory id, title, updated, author, and link. It wouldn't be much use without the content, and it's highly recommended to have the summary, a "a short summary, abstract, or excerpt of the entry."

In addition to those core features, an Atom entry can contain categories and rights information, and an interesting (and unique to Atom) element called source. The source element allows for metadata about an entry's parent feed to be preserved if that entry is copied from one feed to a new one. An example of this might look like:

<source>
  <id>http://example.org/</id>
  <title>Fourty-Two</title>
  <updated>2003-12-13T18:30:02Z</updated>
  <rights>© 2005 Example, Inc.</rights>
</source>

More on the optional subelements that can be used in the entry element can be found here.

Constructs

An Atom feed is made up of standardized elements. Each of these elements is blessed with content that has been organized into one of the options provided by the Reusable Syntax of Constructs. Apart from being a particularly good name for a modern jazz quintet, the idea behind the Reusable Syntax of Constructs is to make the discussion of elements, both established and proposed, much simpler.

The official version 1.0 specification lists two official constructs, although the developer's guide has six: category, content, link, date, person, and text.

Constructs allow new elements, within new namespaces, to be added to an Atom feed in a controlled way. Elements pointing to a person, for example, should use the Person construct, and not reinvent the wheel. Mandating that dates are to be written only in rfc3339 format means that developers do not need to waste time on getting date-parsing code to work with anything else, and so on.

What's to Come?

The Atom Syndication Format is only the first part of the Atom project. It is balanced by the Atom Publishing Protocol, more commonly known as the Atom API. The aim of this project is to improve on, and replace, the existing XML-RPC-based publishing protocols such as the Blogger API. The AtomPub working group also has its specification in the IETF ratification process, if a few steps behind the Syndication Format. Expect to hear a lot more about the Atom Publishing Protocol in the next year.