dongliang1996 2010-04-15 17:33
浏览 40

XMLReader expand()问题 - 产生警告:未启用DOM支持

I'm new to XMLReader and novice at PHP. I'm trying to figure out how to use XMLReader to parse XML files. In particular, I'm trying to grab particular nodes of a very large XML file so that I can rewrite a smaller file with just the subset of nodes I need. So, XMLReader seemed appealing for its supposed speed with $reader->expand().

Although I'm able to print out information from a test xml file with XMLReader, I'm not able to use $reader->expand(). It gives me a "Warning: DOM support is not enabled" message. However, in checking phpinfo(), I know that it is enabled with my hosting service. I've also checked the XML file to make sure it's valid. Here's the test code I've been using to try to get this to work.

$reader = new XMLReader();
$reader->open('http://www.shinyorb.com/static/test.xml');

while ($reader->read()) {
 if ($reader->expand()) {           
      echo "worked <BR>";
 } 
  else {
      echo "bad <BR>";
  } 
}
$reader->close();

Any thoughts, leads, advice would be much appreciated!

  • 写回答

1条回答 默认 最新

  • dongnu4254 2011-03-29 15:14
    关注

    I found that lowering PHP version (5.2.x -> 5.1.x) on a problem hosting fixes the problem. But this looks like hoster does not want to really fix his problem.

    I have simpler test code which indicates the problem:

    <?php
    $xml = new XMLReader();
    $xml->XML('<root/>');
    $xml->read();
    $obj = $xml->expand();
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)