<?php
$indent = 5; /* Number of spaces to indent per level */

$xml = new XMLReader();
$xml->open("onlineplayers.xml");
// CHANGED NEXT TWO LINES TO REMOVE ERROR
// FROM: $xml->setParserProperty(XMLREADER_LOADDTD, TRUE);
$xml->setParserProperty(XMLReader::LOADDTD,  TRUE);
$xml->setParserProperty(XMLReader::VALIDATE, TRUE);
while($xml->read()) {
    /* Print node name indenting it based on depth and $indent var */
    print str_repeat(" ", $xml->depth * $indent).$xml->name."\n";
    if ($xml->hasAttributes) {
        $attCount = $xml->attributeCount;
        print str_repeat(" ", $xml->depth * $indent)." Number of Attributes: ".$xml->attributeCount."\n";
    }
}
print "\n\nValid:\n";
var_dump($xml->isValid());
?>
