xml – 扩展具有更多字段的RSS格式?

我有一个网站,我需要创建一个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>

如果我想添加更多元素以使其可供合作伙伴使用,以便他们可以按需要消费和解析,该怎么办?同时,如果他们添加我的RSS源,我不想破解RSS阅读器。任何想法处理这个最好的方法?

RSS 2.0 Specification说:

“RSS originated in 1999,and has strived to be a simple,easy to
understand format,with relatively modest goals. After it became a
popular format,developers wanted to extend it using modules defined
in namespaces,as specified by the W3C.

RSS 2.0 adds that capability,following a simple rule. A RSS feed may
contain elements not described on this page,only if those elements
are defined in a namespace.”

查看文章Extending RSS 2.0 With Namespaces,其中显示了如何做到这一点。该文章的一个例子显示,作者向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>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念
xml文件介绍及使用
xml编程(一)-xml语法
XML文件结构和基本语法
第2章 包装类
XML入门的常见问题(二)
Java对象的强、软、弱和虚引用
JS解析XML文件和XML字符串详解
java中枚举的详细使用介绍
了解Xml格式
XML入门的常见问题(四)
深入SQLite多线程的使用总结详解
PlayFramework完整实现一个APP(一)
XML和YAML的使用方法
XML轻松学习总节篇