0

我正在从 PHP 生成一个 XML-RSS 类型的文件。

例如输出是这样的

<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
 <channel>
    <title>Mi web mola</title>
    <link>http://www.dominio.com/blog.php</link>
    <language>es-ES</language>
    <description>Mallas y eso</description>
    <generator>Autor</generator>

     <item>
      <title>Articulo de prueba</title>
      <link>http://www.midominio.com/2342</link>
      <pubDate>14/06/2010</pubDate>
      <description><![CDATA[Descripcion de prueba bla bla bla]]></description>
      <content:encoded><![CDATA[Contenido prueba]]></content:encoded>
     </item>

 </channel>
</rss> 

...我在 Firefox 预览中看到的只是博客的标题和描述,而不是项目,但在源代码中它显示正确,所以我认为它一定是解析错误或类似的东西。 .

有什么问题?

再次,原谅我的英语不好,非常感谢你。

4

1 回答 1

1

我不知道这是否是您的 RSS 问题,但就目前而言,这不是有效的 XML-with-namespaces。

如果你想使用一个<content:encoded>元素,你应该为前缀声明一个命名空间content

<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">

pubDate应该是 RFC822 格式,例如。Mon, 14 Jun 2010 12:00:00 GMT.

于 2010-05-16T14:30:38.967 回答