1<?php 2$indent = 5; /* Number of spaces to indent per level */ 3 4$reader = new XMLReader(); 5$reader->open('relaxNG.xml'); 6/* 7Example setting relaxNG using string: 8$reader->setRelaxNGSchemaSource(file_get_contents('relaxNG.rng')); 9*/ 10if ($reader->setRelaxNGSchema('relaxNG.rng')) { 11 while ($reader->read()) { 12 /* Print node name indenting it based on depth and $indent var */ 13 print str_repeat(" ", $reader->depth * $indent).$reader->name."\n"; 14 } 15} 16 17print "\n"; 18 19if (! $reader->isValid()) { 20 print "Document is not valid\n"; 21} else { 22 print "Document is valid\n"; 23} 24 25?>