tags:

views:

84

answers:

0

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!