Files
archived-presentations/slides/php5xml/xmlread_valid1.php
Ilia Alshanetsky bc1df0f093 PHP|Works talks.
2004-10-13 14:53:59 +00:00

13 lines
435 B
PHP

<?php
$reader = new XMLReader();
/* load xml document as a string */
$reader->XML(file_get_contents(dirname(__FILE__) . '/thedata.xml'));
/* tell the parser to perform syntax validation */
$reader->setParserProperty(XMLREADER_VALIDATE, TRUE);
// loop until end of document
// @ blocks the parser errors (missing DTD in this case)
while (@$reader->read());
echo "XML document is: " . ($reader->isValid() ? '' : ' not') . " valid.";
?>