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