O'Reilly logo

RESTful Web Services Cookbook by Subbu Allamaraju

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.3. How to Extend Atom

The Atom format was designed to support future extensions. All elements in the Atom format allow foreign XML elements and attributes. For example, in the following snippet, the atom:author element is extended to include the author’s telephone number:

<atom:author xmlns:atom="http://www.w3.org/2005/Atom">
  <atom:name>John Author</atom:name>
  <atom:uri>http://www.example.org/authors/john-author</atom:uri>
  <atom:email>john.author@mail.example.org</atom:mail>
  <ex:phone xmlns:ex="http://www.example.org/ns">425-123-4567</ex:phone>
</atom:author> 

This is a valid atom:author element. Clients that can understand this extension can interpret the author’s phone numbers, and clients that do not understand it can ignore it. You can extend Atom in the following ways:

  • Add new link relation types. An example is the Feed Paging and Archiving extensions (RFC 5005), which introduce the first, last, previous, and next link relation types.

  • Add new elements within Atom elements such as atom:entry, atom:feed, and atom:link. Examples include Atom Threading Extensions (RFC 4685), which introduces new elements in-reply-to and total, and In-Lining Extensions for Atom, which extends the atom:link element to include atom:entry or atom:feed documents of linked resources.

  • Use foreign XML or other textual content nested inside atom:content elements.

This recipe reviews various ways of extending Atom and presents preferred ways.

Problem

You want to know possible ways to extend Atom.

Solution ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required