0

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

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

XML 文档的前 2 行是:

<?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();
4

1 回答 1

1

您可能在字符串中留下了 BOM。
请向我们展示您的代码。

于 2010-07-12T01:39:24.900 回答