RSS规范及验证

2010-08-26 23:12 0 条评论 »

Feed Validator地址

http://validator.w3.org/feed/check.cgi?url= 

email地址

item的author中email的正确格式如下

Stanley@example.com (Stanley Wang)

前面是email地址,后面括号中的是姓名

 

日期格式

错误提示:element must be an RFC-822 date-time

pubDate,lastBuildDate中的日期必须是 RFC-822 date-time,正确格式如下

Wed, 02 Oct 2002 13:00:00 GMT

如果使用smarty的date_format,则参数为%a, %d %b %Y %H:%M:%S

最后的GMT代表格林威治时间,中国的话可以替换为+0800

 

MIME type

如果是用php输出的rss的话,需要用header输出Content-Type

RSS feeds 1.0 为 application/rdf+xml

RSS feeds 2.0 为 application/rss+xml

Atom feeds 为 application/atom+xml

 

RSS本身的链接

错误提示:

Missing  atom:link  with  rel=”self

解决方法:

首先要在rss标签中声明Atom的Namespace,如下:

<rss version=”2.0″ xmlns:atom=”http://www.w3.org/2005/Atom”>

在channel标签中应该加入带有rel=”self”的atom:link标签,格式如下:

<atom:link href=http://rss地址”  rel=”self” type=”application/rss+xml” />

来源:http://androids-electricsheep.blogbus.com/logs/68652711.html

评论