I am getting an error when attempting to access an RSS feed using Zend_Feed.
The error is as follows:
500 Internal Error
: exception 'Zend_Feed_Exception' with message 'DOMDocument cannot parse
XML: DOMDocument::loadXML() [function.DOMDocument-loadXML]:
xmlParseEntityRef: no name in Entity, line: 54' in
/Library/WebServer/Documents/framework/_library/Zend/Feed.php:204 Stack
trace: #0
/Library/WebServer/Documents/framework/_library/Zend/Feed.php(180):
Zend_Feed::importString('_run('./application/v...') #4
/Library/WebServer/Documents/framework/_library/Zend/Controller/Action/Helper/ViewRenderer.php(742):
Zend_View_Abstract->render('itsfeed/index.p...') #5
/Library/WebServer/Documents/framework/_library/Zend/Controller/Action/Helper/ViewRenderer.php(763):
Zend_Controller_Action_Helper_ViewRenderer->renderScript('itsfeed/index.p...',
NULL) #6
/Library/WebServer/Documents/framework/_library/Zend/Controller/Action/Helper/ViewRenderer.php(810):
Zend_Controller_Action_Helper_ViewRenderer->render() #7
/Library/WebServer/Documents/framework/_library/Zend/Controller/Action/HelperBroker.php(160):
Zend_Controller_Action_Helper_ViewRenderer->postDispatch() #8
/Library/WebServer/Documents/framework/_library/Zend/Controller/Action.php(504):
Zend_Controller_Action_HelperBroker->notifyPostDispatch() #9
/Library/WebServer/Documents/framework/_library/Zend/Controller/Dispatcher/Standard.php(237):
Zend_Controller_Action->dispatch('indexAction') #10
/Library/WebServer/Documents/framework/_library/Zend/Controller/Front.php(911):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #11
/Library/WebServer/Documents/framework/03/index.php(5):
Zend_Controller_Front->dispatch() #12 {main}//////////// module handeler
My code is as follows:
<?
$content = "content:encoded";
$blogfeed =
Zend_Feed::import('http://www.otago.ac.nz/its/notices/notices.xml');
foreach ($blogfeed as $item) {
echo "<BR> \n ";
echo $item- link() . "> \n";
echo $item->title() . " <BR> \n";
}
?>
I am not having problems with other feeds. I saved the xml file locally and
when I tried to open it in Textedit (OS X) I got the following error:
The document “notices.xml” could not be opened. Text encoding Unicode
(UTF-8) is not applicable.
The file may have been saved using a different text encoding, or it may not
be a text file.
I resaved the file using UTF-8 and saved the file to a local web server.
After some trial and error I traced the problem to this line in the xml
file:
<title>Blackboard Service Incidents & Course Statistics</title>
If I manually removed the ampersand so the line is:
<title>Blackboard Service Incidents Course Statistics</title>
I can successfully use the feed. Obviously not ideal as I have no control
over the original source feed. I am pretty new to this so I am probably
missing something simple.
--
View this message in context:
http://www.nabble.com/Zend_Feed-error%2C-possibly-due-to-text-encoding-tf4680929s16154.html#a13375600
Sent from the Zend Framework mailing list archive at Nabble.com.