doutuan4361 2016-10-24 10:29
浏览 260

LoadXML文件太大了

I am trying to load xml content from a URL containing about 60MB of data. When I do that using simple XML built in library I keep getting the following error:

PHP Warning:  DOMDocument::loadXML(): internal error: Huge input lookup in Entity, line: 845125

And the script is being stopped. What's wrong? How can I deal with this?

Sample url I use:

http://foo.com/feed.xml
  • 写回答

1条回答 默认 最新

  • douzhong1730 2016-10-24 10:39
    关注

    The libxml2 changelog contains "608773 add a missing check in xmlGROW (Daniel Veillard)", which seems to be related to input buffering. Note I don't know anything about libxml2 internals, but it seems conceivable that you have tickled a 2.7.6 bug fixed in 2.7.7.

    Check if the behavior is any different when you use simplexml_load_file() directly, and try setting libxml parser-related options, e.g.

    simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_PARSEHUGE)` Specifically, you might want to try the LIBXML_PARSEHUGE flag.

    http://php.net/manual/en/libxml.constants.php XML_PARSE_HUGE flag relaxes any hardcoded limit from the parser. This affects limits like maximum depth of a document or the entity recursion, as well as limits of the size of text nodes.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?