forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path006.phpt
More file actions
36 lines (30 loc) · 703 Bytes
/
006.phpt
File metadata and controls
36 lines (30 loc) · 703 Bytes
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
--TEST--
XMLReader: libxml2 XML Reader, moveToElement
--SKIPIF--
<?php if (!extension_loaded("xmlreader")) print "skip"; ?>
--FILE--
<?php
/* $Id$ */
$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
<books><book num="1"></book><test /></books>';
$reader = new XMLReader();
$reader->XML($xmlstring);
// 2 read to get on the 2nd node
$reader->read();
$reader->read();
if ($reader->nodeType != XMLREADER::END_ELEMENT) {
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
$attr = $reader->moveToFirstAttribute();
if ($reader->moveToElement()) {
if ($reader->name == 'book') {
echo "ok\n";
}
}
}
}
$reader->close();
?>
===DONE===
--EXPECT--
ok
===DONE===