使用更多字段扩展RSS格式?

Tru*_*an1 23 xml rss content-management-system rss2

我有一个网站,我需要为其创建一个RSS源.是否有自定义字段添加到RSS源的标准格式?我想在我的RSS feed中添加一个"location"元素.我有一些合作伙伴想要使用Feed,并且能够使用特定于我的网站的自定义字段.

对于当前的RSS 2.0格式,这些是RSS 2.0规范中提供的包含字段:

<?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>geo@herald.com (George Matesky)</managingEditor>
    <webMaster>betty@herald.com (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>lawyer@boyer.net (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>
Run Code Online (Sandbox Code Playgroud)

如果我想添加更多元素以使其可供合作伙伴使用,以便他们可以随意使用和解析它,该怎么办?与此同时,如果他们将RSS源添加到RSS阅读器中,我不想打破RSS阅读器.有关处理此问题的最佳方法的任何想法?

Dan*_*plo 28

根据RSS 2.0规范然后:

"RSS起源于1999年,并且一直致力于成为一种简单易懂的格式,目标相对适中.在它成为一种流行格式之后,开发人员希望使用W3C规定的名称空间中定义的模块来扩展它.

RSS 2.0遵循一个简单的规则添加了该功能.RSS提要可能包含此页面上未描述的元素,只有在命名空间中定义了这些元素时才会这样."

查看使用命名空间扩展RSS 2.0的文章,其中介绍了如何执行此操作.该文章的一个示例显示作者在其Feed中添加了一些自定义博客字段:

 <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>
Run Code Online (Sandbox Code Playgroud)


Guf*_*ffa 5

您可以使用所需的任何元素扩展RSS消息,RSS阅读器将标准元素与扩展区分开的方式是扩展名在命名空间中.这样,标准阅读器可以轻松读取标准元素并忽略扩展.

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

只有在命名空间中定义了这些元素时,RSS源才可能包含此页面上未描述的元素.