| Line |  | 
|---|
| 1 | <?php | 
|---|
| 2 | $indent = 5; /* Number of spaces to indent per level */ | 
|---|
| 3 |  | 
|---|
| 4 | $xml = new XMLReader(); | 
|---|
| 5 | $xml->open("onlineplayers.xml"); | 
|---|
| 6 | // CHANGED NEXT TWO LINES TO REMOVE ERROR | 
|---|
| 7 | // FROM: $xml->setParserProperty(XMLREADER_LOADDTD, TRUE); | 
|---|
| 8 | $xml->setParserProperty(XMLReader::LOADDTD,  TRUE); | 
|---|
| 9 | $xml->setParserProperty(XMLReader::VALIDATE, TRUE); | 
|---|
| 10 | while($xml->read()) { | 
|---|
| 11 | /* Print node name indenting it based on depth and $indent var */ | 
|---|
| 12 | print str_repeat(" ", $xml->depth * $indent).$xml->name."\n"; | 
|---|
| 13 | if ($xml->hasAttributes) { | 
|---|
| 14 | $attCount = $xml->attributeCount; | 
|---|
| 15 | print str_repeat(" ", $xml->depth * $indent)." Number of Attributes: ".$xml->attributeCount."\n"; | 
|---|
| 16 | } | 
|---|
| 17 | } | 
|---|
| 18 | print "\n\nValid:\n"; | 
|---|
| 19 | var_dump($xml->isValid()); | 
|---|
| 20 | ?> | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.