調べたので備忘録。
種類
RSS1.0
RSS2.0
- 配信する文章の色を変えたり、リンクを仕込めるなど、グラフィック面でいろいろ出来る。コンテンツ配信向き?
- RSS1.0の後継シリーズではない。(0.9x系の流れを汲む規格)
- XMLシリーズを元にして制作されている。
ATOM
構造
RSS1.0
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xml:lang="ja">
<channel rdf:about="サイトのRSSのURL">
<title>サイトのタイトル</title>
<link>サイトのURL</link>
<description>サイトの内容</description>
<dc:date>RSSの最終更新日時</dc:date>
<dc:language>ja</dc:language>
<items>
<rdf:Seq>
<rdf:li rdf:resource="記事1のURL" />
<rdf:li rdf:resource="記事2のURL" />
</rdf:Seq>
</items>
</channel>
<item rdf:about="記事1のURL">
<title>記事1のタイトル</title>
<link>記事1のURL</link>
<description><![CDATA[記事1の内容]]></description>
<dc:creator>記事1の作者名</dc:creator>
<dc:date>記事1の作成日時</dc:date>
</item>
<item rdf:about="記事2のURL">
<title>記事2のタイトル</title>
<link>記事2のURL</link>
<description><![CDATA[記事2の内容]]></description>
<dc:creator>記事2の作者名</dc:creator>
<dc:date>記事2の作成日時</dc:date>
</item>
</rdf:RDF>RSS2.0
<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
<channel>
<title>PHP & JavaScript:更新情報</title>
<link>http://phpjavascriptroom.com/</link>
<description>PHP & JavaScript Room:新着3件</description>
<item>
<title>記事タイトル3</title>
<link>http://phpjavascriptroom.com/post3.html</link>
<description>記事の内容です。</description>
<pubDate>Wed, 11 Jun 2008 15:30:59 +0900</pubDate>
</item>
<item>
<title>記事タイトル2</title>
<link>http://phpjavascriptroom.com/post2.html</link>
<description>記事の内容です。</description>
<pubDate>Tue, 10 Jun 2008 15:30:59 +0900</pubDate>
</item>
<item>
<title>記事タイトル1</title>
<link>http://phpjavascriptroom.com/post1.html</link>
<description>記事の内容です。</description>
<pubDate>Mon, 9 Jun 2008 20:50:30 +0900</pubDate>
</item>
</channel>
</rss><?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xml:lang='ja'>
<id>tag:phpjavascriptroom.comfeed/</id>
<title>PHP & JavaScript Room:更新情報</title>
<updated>2008-06-11T15:30:59Z</updated>
<link rel='alternate' type='text/html' href='http://phpjavascriptroom.com/feed/' />
<link rel='self' type='application/atom+xml' href='http://phpjavascriptroom.com/feed/atom10.xml' />
<entry>
<id>http://phpjavascriptroom.com/post3.html#20080611</id>
<title>記事タイトル3</title>
<link rel='alternate' type='text/html' href='http://phpjavascriptroom.com/post3.html' />
<updated>2008-06-11T15:30:59Z</updated>
<summary>記事の内容です。</summary>
</entry>
<entry>
<id>http://phpjavascriptroom.com/post2.html#200810153059</id>
<title>記事タイトル2</title>
<link rel='alternate' type='text/html' href='http://phpjavascriptroom.com/post2.html' />
<updated>2008-06-10T15:30:59Z</updated>
<summary>記事の内容です。</summary>
</entry>
<entry>
<id>http://phpjavascriptroom.com/post1.html#20080609205030</id>
<title>記事タイトル1</title>
<link rel='alternate' type='text/html' href='http://phpjavascriptroom.com/post1.html' />
<updated>2008-06-09T20:50:30Z</updated>
<summary>記事の内容です。</summary>
</entry>
</feed>要素
- channel
チャンネル情報。<channel>~</channel>- title(必須要素)
チャンネル名。<title>PHP & JavaScript Room:更新情報</title> - link(必須要素)
チャンネルのURL。サイトURL。<link>http://phpjavascriptroom.com/</link> - description(必須要素)
チャンネルの説明。
<description>PHP & JavaScript Room:新着3件</description> - item+
チャンネルのコンテンツ情報。日付が新しいもの順。1つ以上~いくつでも。- title
コンテンツのタイトル。ページタイトルや記事タイトル。
<title>【Ajax】Simple JSの使い方</title> - link
コンテンツのURL。
<link>http://phpjavascriptroom.com/index.php?t=ajax&p=simplejs</link> - description
コンテンツの概要。
<description>14KBの超軽量JSライブラリ「Simple JS」をサンプル付きで紹介。</description> - author
コンテンツを書いた人のメールアドレス。
<author>amarron@yahoo.co.jp (PJ)</author> - category
コンテンツのカテゴリ。
<category>Ajax JavaScript</category> - comments
コンテンツに対するコメントがあるページのURL。
<comments>http://phpjavascriptroom.com/ajax/simplejs.html#comment</comments> - enclosure
コンテンツに添付されるメディアオブジェクト。 - guid
コンテンツのユニークな永続的なURL。
<guid>http://phpjavascriptroom.com/ajax/simplejs#he20080204</guid> - pubDate
コンテンツの公開日。
<pubDate>Mon, 4 Feb 2008 15:30:59 +0900</pubDate><pubDate>Mon, 4 Feb 2008 15:30:59 GMT</pubDate> - source
記事で引用しているRSSのチャンネル。引用元のURLを指定するurl属性は必須属性。
<source url='http://www.sample.com/rss.xml'>sample.com</source>
- title
- title(必須要素)
参考サイト
[Web]RSSとRSS2とATOMの違いをまとめてみる。
[rss][atom]RSSとATOMの文書構造モデル(メモ書き)
RSS -- サイト情報の要約と公開
RSS 2.0 のフォーマット
Atom 1.0 のフォーマット
おすすめ書籍
もっとrssを知りたい方にオススメです。