2010-07-12 85 views
0

我想使用SimplePie解析XML。如果我沒有將set force_feed設置爲TRUE,SimplePie甚至不會將它識別爲RSS。 被SimplePie所示的錯誤消息:SimplePie XML文檔無效

This XML document is invalid, likely due to invalid characters. XML error: Not well-formed (invalid token) at line 1, column 1

第2行中的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

你可能留下的字符串中BOM。
請向我們展示您的代碼。

+0

謝謝,我用代碼更新了這個問題 – SteD 2010-07-12 01:48:56