Atomとは、Webサイトの見出しや要約などのメタデータを構造化して記述する、XMLベースのフォーマットです。技術的にはRSSと同じですが、RSSの混乱を避けるため新しいフォーマットして考案されたものです。Atomとは - IT用語辞典 e-Words
ファイルの拡張子は.atomと定められていますが、実際には.xmlが使用されることもあります。そしてMIMEタイプはapplication/atom+xmlと定められていますが、これも実際にはtext/xmlやapplication/xmlが使われることが多いようです。
Atom Syndication Formatでは、情報を配信できます。これはRSSと同じです。
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>フィードのタイトル</title>
<subtitle>フィードの説明</subtitle>
<id>abcd:1234</id>
<link href="http://example.com/" />
<author>
<name>フィードの著者</name>
</author>
<updated>2013-01-01T00:00:00+09:00</updated>
<entry>
<title>エントリー1のタイトル</title>
<summary>エントリー1の要約</summary>
<id>e1</id>
<link href="http://example.com/item1.html" />
<updated>2013-01-01T01:00:00+09:00</updated>
</entry>
<entry>
<title>エントリー2のタイトル</title>
<id>e2</id>
<updated>2013-01-01T02:00:00+09:00</updated>
</entry>
</feed>
Atomのサンプル
| 要素 | 説明 | 要素の数 | ||
|---|---|---|---|---|
| 0 | 1 | 2以上 | ||
| author | フィードの著者 | ○ ※1 | ○ | ○ |
| category | フィードに関連付けられたカテゴリー | ○ | ○ | ○ |
| contributor | フィードに貢献した人 | ○ | ○ | ○ |
| generator | フィードの生成に使用されたエージェント | ○ | ○ | × |
| icon | フィードを象徴する画像 (縦横比1:1で小さいサイズ) | ○ | ○ | × |
| logo | フィードを象徴する画像 (縦横比2:1) | ○ | ○ | × |
| id | フィードの永久に一意な識別子 | × | ○ | × |
| link | フィードからWebリソースへの参照 | ○ ※2 | ○ | ○ |
| rights | フィードの権利に関する情報 | ○ | ○ | × |
| subtitle | フィードの説明 | ○ | ○ | × |
| title | フィードのタイトル | × | ○ | × |
| updated | フィードに重要な変更が加えられた日時 | × | ○ | × |
| 要素 | 説明 | 要素の数 | ||
|---|---|---|---|---|
| 0 | 1 | 2以上 | ||
| author | エントリーの著者 (feed要素と同じ) | ○ ※1 | ○ | ○ |
| category | (feed要素と同じ) | ○ | ○ | ○ |
| content | (feed要素と同じ) | ○ | ○ | × |
| contributor | (feed要素と同じ) | ○ | ○ | ○ |
| id | (feed要素と同じ) | × | ○ | × |
| link | (feed要素と同じ) | ○ ※2 | ○ | ○ |
| published | エントリーが生成された日時 | ○ | ○ | × |
| rights | (feed要素と同じ) | ○ | ○ | × |
| source | エントリーの元となるフィードの情報 | ○ | ○ | × |
| summary | エントリーの要約、抜粋 | ○ ※3 | ○ | × |
| title | (feed要素と同じ) | × | ○ | × |
| updated | (feed要素と同じ) | × | ○ | × |
<author> <name></name> <uri></uri> <email></email> </author>
日時はRFC 3339の形式で記述します。それは、たとえば
<updated>2013-01-01T00:00:00+09:00</updated>
のような形式です。
Atom Publishing Protocolでは、それに対応したシステムに対して、外部から情報を送受信できます。
実際に使用されている例を見るのが、Atomを理解する助けとなります。比較のため、同一のフィードのRSSへもリンクを張っています。