PHP XMLReader RNG Schema fails to load

Ulcecyeteleah

New Member
Trying to load a large RNG file hangs the server, but the other two smaller RNG files load and I can validate XML against them. Any help on this? LITE and BARE are able to load, but the large RNG of ALL which is over 17000 lines is what hangs.PHP Version 5.2.17.LIBXML Version 2.8.0LIBXML Support and Streams, SCHEMA and RNG support, and XMLReader are enabled`\[code\]try { // Setting some default XML for testing. This is a valid TEI Lite XML string for testing. $xml = '<?xml version="1.0" encoding="UTF-8"?><TEI xmlns="http://www.tei-c.org/ns/1.0"><teiHeader><fileDesc><titleStmt><title>Title</title></titleStmt><publicationStmt><p>Publication information</p></publicationStmt><sourceDesc><p>Information about the source</p></sourceDesc></fileDesc></teiHeader><text><body><p>Some text here.</p><figure><graphic url="http://www.tei-c.org/logos/TEI-glow.png"/></figure></body></text></TEI>'; $xmlDocument = new XMLReader; if (!$xmlDocument->xml($xml, NULL, LIBXML_PARSEHUGE)) { // original, but causes error on codepad. print("<p class=\"error\">TEI Document is not well formed, validation cannot continue.</p>"); exit(); } // LITE and BARE get loaded, but ALL hangs.. LITE is ~5000 lines, BARE is ~1000 lines, and ALL is ~17,000 lines. $rng = "http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_bare.rng"; $rng = "http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng"; $rng = "http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_lite.rng"; if ($xmlDocument->setRelaxNGSchema($rng)) { while($xmlDocument->read()); $xmlDocument->close(); } else { print("<p class=\"error\">An error occurred while loading the schema. Please try again or contact your IT support.</p>"); } if ($validateError = libxml_get_last_error()) { print("<p class=\"error\">TEI Document was not valid.</p>"); if ($validateError) { print("<p class=\"error\">Error on line " . $validateError->line . " : " . $validateError->message . ".</p>"); } } else { print("TEI Document is valid."); }} catch (Exception $e) { throw new Exception("<p class=\"error\">A serious error occurred with the validator, please contact your IT support.</p>", 0, $e);}\[/code\]`
 
Back
Top