|
PhotoFeedFormat
图贴摘要格式规范BBS站点通过图贴摘要(Photo Post Feed)向谷歌看图提供论坛图贴的内容。图贴摘要本质上是一种网络摘要(Web Feed,简称网摘),谷歌看图使用的图贴摘要格式是基于目前常见的网络摘要格式RSS设计的。因此,BBS站点可以利用已有的网摘生成库方便地生成图贴摘要。图贴摘要在RSS上引入了扩展,以提供论坛图贴特有的内容信息,例如帖子的分页信息。 示例<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:forum="http://schemas.google.com/photos/forum/2008">
<channel>
<title>Title of this BBS thread</title>
<link>http://www.bbs-domain.com</link>
<description>Description of this thread</description>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
<forum:pagination>
<forum:current page="2">
http://www.bbs-domain.com/?page=2
</forum:current>
<forum:previous page="1">
http://www.bbs-domain.com/?page=1
</forum:previous>
<forum:next page="3">
http://www.bbs-domain.com/?page=3
</forum:next>
</forum:pagination>
<item>
<title>Title of the Post 1</title>
<link>http://www.bbs-domain.com/postlink1</link>
<description>Description of this Post 1</description>
<author>author 1</author>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<guid>http://www.bbs-domain.com/postlink1</guid>
<forum:post>
<forum:paragraph>Paragraph 1</forum:paragraph>
<forum:image>http://www.bbs-domain.com/image?id=1</forum:image>
<forum:paragraph>Paragraph 2</forum:paragraph>
<forum:image>http://www.bbs-domain.com/image?id=2</forum:image>
</forum:post>
</item>
<item>
<title>Title of the Post 2</title>
<link>http://www.bbs-domain.com/postlink2</link>
<description>Description of this Post 2</description>
<author>author 2</author>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<guid>http://www.bbs-domain.com/postlink1</guid>
<forum:post>
<forum:paragraph>Paragraph 1</forum:paragraph>
<forum:image>http://www.bbs-domain.com/image?id=3</forum:image>
</forum:post>
</item>
</channel>
</rss>定义RSS定义元素图贴摘要采用了RSS 2.0的基本框架,按照RSS格式的规定进行了扩充。对于RSS的基本元素的定义,请参考RSS格式规范。通常情况下,一个图贴摘要包含了一个论坛帖子一页的信息,而摘要中每个item对应帖子中的一条消息或回复。帖子的相关信息,可由RSS定义的 <channel> 的子元素给定,如发表帖子主题等,而一条消息的相关信息,可由RSS定义的 <item> 的子元素给定。 图贴feed引入了一个RSS模块,在模块定义的命名空间中,引入新的元素,使用这些元素提供图贴阅读器所需的信息。本节对扩展引入的元素进行了定义和解释。 扩展命名空间元素图贴feed扩展统一使用下面的命名空间URI: http://schemas.google.com/photos/forum/2008 本规范和示例使用XML元素前缀 *forum* 来标明XML来自于上述的URI。根据XML规范,该前缀的选取可任意指定,并没有语义上的区别。 <forum:pagination>元素<forum:pagination>元素用于指明摘要中图贴的分页信息。BBS服务器通常都会将一个论坛帖子和其回复分页显示,这样做可以在用户请求帖子内容的时候,仅仅从数据库读取一定数量的帖子内容,不用对数据库进行所有数据的读取,从而节省服务器的CPU和内存资源,并减少用户的等待时间。通过<forum:pagination>元素,BBS服务器可以用类似的逻辑生成帖子的部分内容提供给图贴阅读器,图贴阅读器会根据<forum:pagination>里的信息,首先载入当前页面的内容,然后再根据需要载入其他页面的内容。 <forum:pagination> 是RSS <channel>元素的可选子元素。其所有的子元素 <forum:current>, <forum:previous> ,和 <forum:next> 都是可选的,分别指定当前页,上一页和下一页的信息。每个子元素有一个必须的属性page,指定对于页的页码编号。元素内容为帖子相应页摘要的URL。 <forum:post>元素<forum:post> 是RSS<item>元素的一个可选子元素。图贴阅读器将从该元素中读取图片和文字信息。其子元素<forum:paragraph> 和 <forum:image> 分别指定了图贴或其回复中的文字和图片,它们都是可选而且可重复的。图贴阅读器将按照它们在 <forum:post> 中的顺序显示一个图贴的内容。<forum:paragraph> 给出了帖子中的一段文字,<forum:image> 给出了嵌在帖子文字中一张图片的URL。 图贴下载摘要格式规范谷歌看图通过图贴下载摘要(Photo Download Feed)想Picasa提供下载图片信息。图贴下载摘要同样遵循RSS标准,并扩展了部分标签。 示例<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:exif="http://schemas.google.com/photos/exif/2007" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" xmlns:photo="http://www.pheed.com/pheed/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gphoto="http://schemas.google.com/photos/2007" version="2.0">
<channel>
<title>Title of this BBS thread</title>
<link>http://www.bbs-domain.com</link>
<description>Description of this thread</description>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
<gphoto:user>tester</gphoto:user>
<item>
<title>Title of the Post 1</title>
<link>http://www.bbs-domain.com/postlink1</link>
<description>Description of this Post 1</description>
<author>author 1</author>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<media:group>
<media:content url="http://www.bbs-domain.com/image/image1.jpg" medium="image"/>
</media:group>
</item>
<item>
<title>Title of the Post 2</title>
<link>http://www.bbs-domain.com/postlink2</link>
<description>Description of this Post 2</description>
<author>author 2</author>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<media:group>
<media:content url="http://www.bbs-domain.com/image/image2.jpg" medium="image"/>
</media:group>
</item>
</channel>
</rss>术语对照
|
Sign in to add a comment