首页 文章

SimplePie XML文档无效

提问于
浏览
0

我试图使用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 回答

  • 1

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

相关问题