Atomを記述する際の書式を紹介します。
XML宣言は以下となります。
<?xml version="1.0" encoding="utf-8"?>
XMLドキュメントのルート要素となるfeedタグは以下の書式です。
<feed xmlns="http://www.w3.org/2005/Atom">
...
</feed>
feed内の要素は以下があります。
authorはPerson Construct構造で以下の子要素を持てます。
entry要素には以下の子要素を持てます。
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>フィードのタイトル</title>
<link href="http://www.ipentec.com/"/> <!-- サイトのURL -->
<updated>2014-10-01T18:30:02Z</updated> <!-- 更新日時 -->
<author>
<name>iPentec PENGUIN</name> <!-- 作成者 -->
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> <!-- ID -->
<entry>
<title>記事のタイトル</title>
<link href="http://www.ipentec.com/article/01"/> <!-- リンク先 -->
<id>urn:uuid:E4E08C52-2636-4760-BC5F-6ADA47E5DD75</id> <!-- ID -->
<updated>2014-04-13T18:30:02Z</updated> <!-- 更新日時 -->
<summary>記事の概要</summary>
</entry>
<entry>
<title>記事のタイトル</title>
<link href="http://www.ipentec.com/article/01"/> <!-- リンク先 -->
<id>urn:uuid:89514132-6671-4A7C-9834-7C8F78960578</id> <!-- ID -->
<updated>2014-04-10T18:30:02Z</updated> <!-- 更新日時 -->
<summary>記事の概要</summary>
</entry>
<entry>
<title>記事のタイトル</title>
<link href="http://www.ipentec.com/article/01"/> <!-- リンク先 -->
<id>urn:uuid:CAFB28F8-2457-46DF-ACBE-2506770136D2</id> <!-- ID -->
<updated>2014-04-01T18:30:02Z</updated> <!-- 更新日時 -->
<summary>記事の概要</summary>
</entry>
</feed>
idは個々のアイテムに対して唯一となるIDを記述します。
URLの変更があったとしても同一性が保持できることが望ましいとされているため、IDにURLを記述するのはお勧めできません。
GUIDやUUIDなどのID値を記載します。
ホストを利用している場合は下記のようにホスト名を記載する場合もあります。
<id>tag:ipentec.com,2014:1</id>
また、updatedタグなどの時刻表記はISO8601形式で記述します。
Atomの仕様は RFC 4287 とRRFC 5023 にまとめられています。