Anne van Kesteren

Atom example

Web Forms 2.0 in IE expressed in draft-ietf-atompub-format-08:

<feed xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-08" xml:base="http://annevankesteren.nl/">
 <title>Anne’s Weblog about Markup &amp; Style</title> 
 <link href="http://example.org/"/>
 <updated>2005-05-21T09:09:43Z</updated>
 <author> 
  <name>Anne van Kesteren</name>
  <uri>http://annevankesteren.nl/about</uri>
 </author> 
 <entry>
  <title type="html">Web Forms 2.0 in &lt;abbr title=&quot;Internet Explorer&quot;&gt;IE&lt;/abbr&gt;</title>
  <link href="/archives/2005/05/web-forms-2"/>
  <summary>The implementation of Web Forms 2.0 in Internet Explorer has started.</summary>
  <id>tag:annevankesteren.nl,2005-05-21:/090943/web-forms-2</id>
  <updated>2005-05-21T09:09:43Z</updated>
 </entry>
</feed>

Instead of using type="html" I could have used type="xhtml". For comparison, that would look like this:

<title type="xhtml">
 <div xmlns="http://www.w3.org/1999/xhtml">
  Web Forms 2.0 in <abbr title="Internet Explorer">IE</abbr>
 </div>
</title>

Dropping the DIV element here is impossible as Atom requires a DIV element in XHTML constructs. I believe it is for interoperability, but even with this DIV element I can make it totally unsafe for copy and paste:

<foo:title type="xhtml">
 <div:div>
  <bar:abbr title="Extensible Markup Language">XML</bar:abbr>
 </div:div>
</foo:title>

Where the foo prefix is bound to the Atom namespace (I guess that will look like http://www.w3.org/2005/atom) and div and bar are bound to the http://www.w3.org/1999/xhtml namespace. Fun!

The good thing of Atom is that everything is defined. I don’t have to guess how things work and I don’t have to worry about data loss. Before I get e-mails from Atom zealots: it is indeed possible to represent a single entry in an atom:entry root element. I’m just demonstrating how a feed looks like. That there can be more entries in a feed is something I hope that’s obvious.