[BUG]论坛的rss缺少了xml文件类型声明

论坛日常站务以及建议或咨询
回复
soiamso
帖子: 418
注册时间: 2008-09-06 2:00

[BUG]论坛的rss缺少了xml文件类型声明

#1

帖子 soiamso » 2008-10-18 0:00

可能要添加以下代码在头部

代码: 全选

<?xml version="1.0" encoding="utf-8"?>
例子:http://cyber.law.harvard.edu/rss/exampl ... sample.xml


http://www.w3.org/TR/REC-xml/
http://cyber.law.harvard.edu/rss/rss.html

我看到乱码了,其他人在使用的时候没有问题吗?

可能也不多人在使用

不知到论坛的atom有没有错。
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

Re: [BUG]论坛的rss缺少了xml文件类型声明

#2

帖子 oneleaf » 2008-10-18 9:56

我检查过了,有添加的。
$ head feed_atom.html
<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{TITLE}</title>
<subtitle>{DESCRIPTION}</subtitle>
<link rel="self" href="{LINK}" />
<updated>{PUBDATE}</updated>
<id>{LINK}</id>
<!-- BEGIN item -->
<entry>
<title>{item.TITLE}</title>
$ head feed_rss2.html
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:annotate="http://purl.org/rss/1.0/modules/annotate/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<channel>
<title>{TITLE}</title>
<description>{DESCRIPTION}</description>
<link>{LINK}</link>
soiamso
帖子: 418
注册时间: 2008-09-06 2:00

Re: [BUG]论坛的rss缺少了xml文件类型声明

#3

帖子 soiamso » 2008-10-18 13:46

我刚抓了一下feed.php


xml类型声明 <?xml version="1.0" encoding="utf-8"?>
确实没有发送到客户端。

代码: 全选

HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
X-Powered-By: PHP/5.2.4-2ubuntu5.3
Set-Cookie: ubuntu_forum_u=1; expires=Sun, 18-Oct-2009 05:07:53 GMT; path=/; domain=forum.ubuntu.org.cn; HttpOnly
Set-Cookie: ubuntu_forum_k=; expires=Sun, 18-Oct-2009 05:07:53 GMT; path=/; domain=forum.ubuntu.org.cn; HttpOnly
Set-Cookie: ubuntu_forum_sid=ec105cf1e24e6365e87989e967cba769; expires=Sun, 18-Oct-2009 05:07:53 GMT; path=/; domain=forum.ubuntu.org.cn; HttpOnly
Content-Type: application/rss+xml; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Sat, 18 Oct 2008 05:07:54 GMT
Server: lighttpd/1.4.19

代码: 全选

<rss version="2.0"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:annotate="http://purl.org/rss/1.0/modules/annotate/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	>
<channel>
	<title>Ubuntu中文论坛</title>
	<description>致力于Ubuntu中文推广</description>
	<link>http://forum.ubuntu.org.cn</link>
	<pubDate>Sat, 18 Oct 2008 13:07:54 +0800</pubDate>
上次由 soiamso 在 2008-10-18 13:55,总共编辑 1 次。
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

Re: [BUG]论坛的rss缺少了xml文件类型声明

#4

帖子 oneleaf » 2008-10-18 13:55

的确没有,是我疏忽,查查先。
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

Re: [BUG]论坛的rss缺少了xml文件类型声明

#5

帖子 oneleaf » 2008-10-18 14:16

$ w3m -dump feed.php|head
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:annotate="http://purl.org/rss/1.0/modules/annotate/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<channel>
<title>Ubuntu中文论坛</title>
<description>致力于Ubuntu中文推广</description>
<link>http://forum.ubuntu.org.cn</link>

ok已经修正。
回复