SimplePie XML文档无效

时间:2010-07-12 01:27:40

标签: php rss simplepie

我正在尝试使用SimplePie解析XML。如果我没有将set force_feed设置为TRUE,SimplePie甚至不会将其识别为RSS。 SimplePie显示的错误消息:

  

此XML文档很可能无效   由于字符无效。 XML错误:   格式不正确(令牌无效)   第1行第1列

XML文档的前两行是:

<?xml version="1.0" encoding="ISO-8859-1"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">

知道这里出了什么问题吗?

编辑(使用代码更新):

$feed_stomp = new SimplePie();
$feed_stomp->set_feed_url('http://singaporeseen.stomp.com.sg/site/servlet/rss?view=rss&vertical=contentbean%3a3552');
$feed_stomp->force_feed(true);
$feed_stomp->init();
$feed_stomp->handle_content_type();
echo $feed_stomp->error();

1 个答案:

答案 0 :(得分:1)

你可能在字符串中留下了一个BOM 请告诉我们您的代码。

相关问题