RSS
RSS feedとは、ウェブサイトの更新情報を配信するためのテキストデータで、XML形式で記述されている。ウェブサイトにRSSフィードを配置しておくと、RSSリーダーからウェブサイトの更新情報を取得することができる。
RSSの種類
RSSはネットスケープコミュニケーションズが「Rich Site Summary」として開発した。ネットスケープコミュニケーションズがRSSの開発を止めて以降、3つの団体が独自にRSSを開発してきた。そのため、現在のRSSは以下に示す3種類がある。
RSS 1.0 | RDF Site Summary |
RSS 2.0 | Really Simple Syndication |
Atom | Atom Syndication Format |
RSS 1.0とRSS 2.0は開発している団体が異なり、新旧を表わしているわけではなく、互換性も無い。
<link>
RSS または Atom のフィードが存在することを明示するには、link 要素でマークアップする。
RSS 1.0 を指定する例を次に示す。
<link rel="alternate" type="application/rss+xml" title="RSS 1.0" href="https://example.com/index.rdf">
RSS 2.0 を指定する例を次に示す。
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="https://example.com/rss.xml">
Atom を指定する例を次に示す。
<link rel="alternate" type="application/atom+xml" title="Atom" href="https://example.com/atom.xml">
RSS 1.0
RSS (RDF Site Summary) 1.0 の構造を次に示します。
RSSは、少なくとも2つの名前空間(ネームスペース)を使用する。ひとつは http://purl.org/rss/1.01
であり、慣習的にデフォルトの名前空間として使用される。もうひとつは http://www.w3.org/1999/02/22-rdf-syntax-ns#
である。接頭辞(プリフィクス)は任意に付けられるが、慣習的にrdfが使われる。
RSSのルート要素は、名前空間 http://www.w3.org/1999/02/22-rdf-syntax-ns#
に属するRDF要素であり、名前空間の接頭辞rdfを付けて、rdf:RDFと表記される。
rdf:RDF 要素
channel 要素を子要素として持ちます。
<?xml version="1.0" encoding="Shift_JIS"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml:lang="ja">
</rdf:RDF>
channel 要素
ウェブサイト全体に関する概要を示す要素です。title 要素および link、description、items、item 要素を子要素として持ちます。
rdf:about 属性は、対象となるサイトの URI を示します。
<channel rdf:about="https://segakuin.com/rss.rdf">
<title>SE学院</title>
<link>https://segakuin.com</link>
<description>システムエンジニアのスキルアップを支援するサイト</description>
<items>
<rdf:Seq>
<rdf:li rdf:resource="https://segakuin.com/xml/" />
<rdf:li rdf:resource="https://segakuin.com/xml/pi.html" />
</rdf:Seq>
</items>
</channel>
title 要素
title 要素は、タイトル(見出し)を表します。channel 要素の子要素としての title 要素は、サイトの見出しを示します。item 要素の子要素としての title 要素は、記事の見出しを表します。
<title>SE学院</title>
link 要素
link 要素は、対象となる URI を表します。 channel 要素の子要素としての link 要素は、サイトの URI を示します。 item 要素の子要素としての link 要素は、、記事の URI を表します。
基本的に channel 要素または item 要素の rdf:about 属性の値と同じです。
<link>https://segakuin.com</link>
description 要素
description 要素は、要約を表します。 channnel 要素の子要素としての description 要素は、サイトの要約を示します。 item 要素の子要素としての description 要素は、記事の要約を示します。
<description>システムエンジニアのスキルアップを支援するサイト</description>
items 要素
サイトの目次を示す要素です。
<items>
<rdf:Seq>
<rdf:li rdf:resource="https://segakuin.com/xml/" />
<rdf:li rdf:resource="https://segakuin.com/xml/pi.html" />
</rdf:Seq>
</items>
ref:li 要素
目次を構成する各記事を示す要素です。
rdf:recource 属性は、各記事の URI を示します。
<?xml version="1.0" encoding="Shift_JIS"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml:lang="ja">
<channel rdf:about="https://segakuin.com/rss.rdf">
<title>システムエンジニアのスキルアップ</title>
<link>https://segakuin.com</link>
<description>システムエンジニアのスキルアップを支援するサイト</description>
<items>
<rdf:Seq>
<rdf:li rdf:resource="https://segakuin.com/xml/" />
</rdf:Seq>
</items>
</channel>
</rdf:RDF>
item 要素
items 要素で目次として示した記事について、item 要素でそれぞれの記事について概要を記述します。
rdf:about 属性は、対象となる URI を示します。
<?xml version="1.0" encoding="Shift_JIS"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml:lang="ja">
<channel rdf:about="https://segakuin.com/rss.rdf">
<title>システムエンジニアのスキルアップ</title>
<link>https://segakuin.com</link>
<description>システムエンジニアのスキルアップを支援するサイト</description>
<items>
<rdf:Seq>
<rdf:li rdf:resource="https://segakuin.com/xml/" />
</rdf:Seq>
</items>
</channel>
<item rdf:about="https://segakuin.com/xml/">
<title>HTMLタグ link要素</title>
<link>https://segakuin.com/xml/</link>
<description>XML (Extensible Markup Language)とは構造化データを記述するためのマークアップ言語です。</description>
</item>
</rdf:RDF>
RSS 2.0
rss
RSS 2.0のルート要素
<rss version="2.0">
</rss>
ポッドキャスト
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>Tsukaのおしゃべりポッドキャスト</title>
<itunes:owner>
<itunes:email>tsuka@example.com</itunes:email>
</itunes:owner>
<itunes:author>tsuka</itunes:author>
<description>日々の出来事や感じたことを語ります。</description>
<itunes:image href="https://www.example.com/podcasts/tsuka/img/podcast.jpg"/>
<language>ja-jp</language>
<link>https://www.example.com/podcasts/tsuka/</link>
<item>
<title>鎌倉へ旅行に行ってきました</title>
<description>鎌倉へ旅行に行ったときの思い出を語ります。</description>
<pubDate>Sun, 28 Aug 2022 12:00:00 GMT</pubDate>
<enclosure url="https://www.example.com/podcasts/tsuka/audio/kamakura.mp3" type="audio/mpeg" length="26004388"/>
<itunes:duration>15:30</itunes:duration>
<guid>tsukakamakura</guid>
</item>
</channel>
</rss>
guid
ポッドキャストのエピソードに永続的に割り当てられるグローバルで一意の識別子
Atom
AtomはIETFにおいてRFC 4287として仕様が公開されている。
feed
Atomのルート要素
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<link href="https://segakuin.com/"/>
<updated>2022-12-07T18:30:02Z</updated>
<author>
<name>Tsukamoto Hiroyuki</name>
</author>
<entry>
<title>RSS</title>
<link href="https://segakuin.com/xml/rss/"/>
<updated>2022-12-07T18:30:02Z</updated>
<summary>Some text.</summary>
</entry>
</feed>
関連記事
UUID (Universally Unique Identifier)
参考文献
Aaron Swartz (2000) RDF Site Summary (RSS) 1.0
RSS Advisory Board (2009) RSS 2.0 Specification (Current)
The Internet Society (2005) RFC 4287 (The Atom Syndication Format)