Annotation of embedaddon/php/ext/xmlreader/tests/007.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: XMLReader: libxml2 XML Reader, setRelaxNGSchema
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded("xmlreader")) print "skip"; ?>
                      5: --FILE--
                      6: <?php 
1.1.1.2 ! misho       7: /* $Id$ */
1.1       misho       8: 
                      9: $xmlstring = '<TEI.2>hello</TEI.2>';
                     10: $relaxngfile = dirname(__FILE__) . '/relaxNG.rng'; 
                     11: $file = dirname(__FILE__) . '/__007.xml';
                     12: file_put_contents($file, $xmlstring);
                     13: 
                     14: $reader = new XMLReader();
                     15: $reader->open($file);
                     16: 
                     17: if ($reader->setRelaxNGSchema($relaxngfile)) {
                     18:   while ($reader->read());
                     19: }
                     20: if ($reader->isValid()) {
                     21:   print "file relaxNG: ok\n";
                     22: } else {
                     23:   print "file relaxNG: failed\n";
                     24: }
                     25: $reader->close();
                     26: unlink($file);
                     27: 
                     28: 
                     29: $reader = new XMLReader();
                     30: $reader->XML($xmlstring);
                     31: 
                     32: if ($reader->setRelaxNGSchema($relaxngfile)) {
                     33:   while ($reader->read());
                     34: }
                     35: if ($reader->isValid()) {
                     36:   print "string relaxNG: ok\n";
                     37: } else {
                     38:   print "string relaxNG: failed\n";
                     39: }
                     40: 
                     41: $reader->close();
                     42: 
                     43: $reader = new XMLReader();
                     44: $reader->XML($xmlstring);
                     45: 
                     46: if ($reader->setRelaxNGSchema('')) {
                     47:        echo 'failed';
                     48: }
                     49: $reader->close();
                     50: ?>
                     51: ===DONE===
                     52: --EXPECTF--
                     53: file relaxNG: ok
                     54: string relaxNG: ok
                     55: 
                     56: Warning: XMLReader::setRelaxNGSchema(): Schema data source is required in %s on line %d
                     57: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>