Back to index

php5  5.3.10
xmlreader_file.php
Go to the documentation of this file.
00001 <?php
00002 $reader = new XMLReader();
00003 $reader->open('xmlreader.xml');
00004 while ($reader->read()) {
00005        if ($reader->nodeType != XMLREADER::END_ELEMENT) {
00006               print "Node Name: ".$reader->name."\n";
00007               print "Node Value: ".$reader->value."\n";
00008               print "Node Depth: ".$reader->depth."\n";
00009               if ($reader->nodeType==XMLREADER::ELEMENT && $reader->hasAttributes) {
00010                      $attr = $reader->moveToFirstAttribute();
00011                      while ($attr) {
00012                             print "   Attribute Name: ".$reader->name."\n";
00013                             print "   Attribute Value: ".$reader->value."\n";
00014                             $attr = $reader->moveToNextAttribute();
00015                      }
00016               }
00017               print "\n";
00018        }
00019 }
00020 ?>