diff options
Diffstat (limited to 'ext/xmlreader/tests/006.phpt')
-rw-r--r-- | ext/xmlreader/tests/006.phpt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/ext/xmlreader/tests/006.phpt b/ext/xmlreader/tests/006.phpt new file mode 100644 index 0000000..ce9bb45 --- /dev/null +++ b/ext/xmlreader/tests/006.phpt @@ -0,0 +1,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=== |