douhuilin1152 2012-08-08 14:58
浏览 214
已采纳

DOMDocument无法解析XML

I'm using Zend_Feed_Atom to get a feed from a website but I'm receiving this error:

Message:

DOMDocument cannot parse XML: DOMDocument::loadXML() [domdocument.loadxml]: xmlParseEntityRef: no name in Entity, line: 827

I tried with another site and I had no error. I want to know why do I get an error with that particular page and what does this error mean. I have looked online and it says that is a problem with the encoding (Which I don't really understand).

my code is simple, its just

if($type_feed == "atom"){
    $nfeed = new Zend_Feed_Atom($address);  
}elseif($type_feed == "rss"){
    $nfeed= new Zend_Feed_RSS($address);
}

Any help would be awesome! thanks!

  • 写回答

2条回答 默认 最新

  • dragon87836215 2012-08-09 08:23
    关注

    If the feed is busted then it is busted, there is little we can do about that.

    One method of getting around this is to use @ to suppress the error.

    if($type_feed == "atom"){
        $nfeed = @new Zend_Feed_Atom($address);  
    }elseif($type_feed == "rss"){
        $nfeed= @new Zend_Feed_RSS($address);
    }
    

    Note that this is not ideal as it will suppress everything when new is called.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型