Atom フォーマット (Atom の書式と形式) の主要要素の紹介

Atomを記述する際の書式を紹介します。

書式

XML宣言(XML Declaration)

XML宣言は以下となります。

<?xml version="1.0" encoding="utf-8"?>

ルート要素 (feedタグ)

XMLドキュメントのルート要素となるfeedタグは以下の書式です。

<feed xmlns="http://www.w3.org/2005/Atom">
  ...
</feed>

feed内要素

feed内の要素は以下があります。

  • title : フィードのタイトル
  • link : フィードのサイトのURL
  • updated : フィードの更新日時
  • author : 著者情報
  • id : ID情報
  • entry : エントリーの情報


author

authorはPerson Construct構造で以下の子要素を持てます。

  • name : 著者の名前
  • url : 著者のWebページのURL
  • email : 著者のe-mail
  • (拡張要素)

entry

entry要素には以下の子要素を持てます。

  • author : 著者情報
  • category : カテゴリ
  • content
  • contributor
  • id
  • link : リンク先
  • published : 出版日
  • rights
  • source
  • summary
  • title
  • updated : 更新日

書式例

<?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 にまとめられています。


AuthorPortraitAlt
著者
iPentec.com の代表。ハードウェア、サーバー投資、管理などを担当。
Office 365やデータベースの記事なども担当。
作成日: 2014-03-03
Copyright © 1995–2025 iPentec all rights reserverd.