2011-08-07 12 views
20

私はRSSフィードを作成するために必要なウェブサイトを持っています。 RSSフィードにカスタムフィールドを追加するための標準形式はありますか? RSSフィードに「location」要素を追加したいと思います。フィードを使用して、自分のウェブサイトに固有のカスタムフィールドを使用できるようにするパートナーがいくつかあります。現在のRSS 2.0形式について複数のフィールドでRSS形式を拡張しますか?

、これらは2.0の仕様RSSから入手含めフィールドです:私はパートナーのためにそれらを利用できるように複数の要素を追加したい場合、彼らは消費し、解析することができるように何

<?xml version="1.0" encoding="UTF-8" ?> 
<rss version="2.0"> 
    <channel> 
    <title>RSS Example</title> 
    <description>This is an example of an RSS feed</description> 
    <link>http://www.domain.com/link.htm</link> 
    <lastBuildDate>Mon, 28 Aug 2006 11:12:55 -0400 </lastBuildDate> 
    <pubDate>Tue, 29 Aug 2006 09:00:00 -0400</pubDate> 
    <language>en-us</language> 
    <copyright>Copyright 2002, Spartanburg Herald-Journal</copyright> 
    <managingEditor>[email protected] (George Matesky)</managingEditor> 
    <webMaster>[email protected] (Betty Guernsey)</webMaster> 
    <category>Newspapers</category> 
    <generator>MightyInHouse Content System v2.3</generator> 
    <docs>http://blogs.law.harvard.edu/tech/rss</docs> 
    <image> 
     <title>Something</title> 
     <url>http://something.com/image.jpg</url> 
     <link>http://something.com</link> 
     <description>This is something</description> 
    </image> 
    <rating>(PICS-1.1 "http://www.classify.org/safesurf/" l r (SS~~000 1))</rating> 
    <item> 
     <title>Item Example</title> 
     <description>This is an example of an Item</description> 
     <link>http://www.domain.com/link.htm</link> 
     <guid> 1102345</guid> 
     <pubDate>Tue, 29 Aug 2006 09:00:00 -0400</pubDate> 
     <author>[email protected] (Lawyer Boyer)</author> 
     <category>Grateful Dead</category> 
     <comments>http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290</comments> 
     <enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3" length="12216320" type="audio/mpeg" /> 
     <source url="http://www.tomalak.org/links2.xml">Tomalak's Realm</source> 
    </item> 
    </channel> 
</rss> 

彼らは彼らが好きですか?同時に、RSSリーダーを追加した場合、RSSリーダーを壊すことはしません。これを処理する最善の方法に関するアイデアはありますか?

答えて

24

はその後RSS 2.0 Specificationによると:。それは 一般的なフォーマットになった後

「RSSは1999年に生まれ、そして比較的控えめな目標に、形式を理解 に簡単、シンプルに努めてきました、開発者は、W3Cによって指定されるモジュールは、名前空間に を定義使用してそれを拡張したいと思った。

RSS 2.0は、単純なルールに従って、その能力を付加する。RSSフィードの要素ではないdescribを 含んでいてもよいですこれらの要素 が名前空間に定義されている場合にのみ、このページで編集できます。

これを行う方法を示すExtending RSS 2.0 With Namespacesの記事をご覧ください。記事の例には、フィードにカスタムブログフィールドを追加した著者が表示されています。

<rss version="2.0" 
    xmlns="http://backend.userland.com/rss2" 
    xmlns:blogChannel="http://backend.userland.com/blogChannelModule"> 
<channel> 
    <title>Scripting News</title> 
    <link>http://www.scripting.com/</link> 
    <blogChannel:blogRoll>http://radio.weblogs.com/ ... /file.opml</blogChannel:blogRoll> 
    <blogChannel:mySubscriptions>http://ra ... /file.opml</blogChannel:mySubscriptions> 
    <blogChannel:blink>http://inessential.com/</blogChannel:blink> 
    . 
    . 
    . 
</channel> 
</rss> 
3

任意の要素でRSSメッセージを拡張できます。また、RSSリーダーが標準要素と拡張機能を区別する方法は、拡張機能が名前空間にあることです。そうすれば、標準的な読者は標準の要素を読みやすく、拡張を無視することができます。

http://cyber.law.harvard.edu/rss/rss.html#extendingRss

RSSフィードは、それらの要素が名前空間で定義されている場合のみ、このページに記載されていない要素が含まれていてもよいです。

関連する問題