1--TEST-- 2XMLReader: next basic 3--EXTENSIONS-- 4xmlreader 5--FILE-- 6<?php 7 8$xml = '<?xml version="1.0" encoding="UTF-8"?><nodes><node1><sub /></node1> 9<node2><sub /></node2><node3><sub /></node3><node4><sub /></node4></nodes>'; 10 11$reader = new XMLReader(); 12 13try { 14 $reader->read(); 15} catch (Error $exception) { 16 echo $exception->getMessage() . "\n"; 17} 18 19try { 20 $reader->next(); 21} catch (Error $exception) { 22 echo $exception->getMessage() . "\n"; 23} 24 25$reader->close(); 26 27$reader->XML($xml); 28$reader->read(); 29$reader->read(); 30echo $reader->name . PHP_EOL; 31var_dump($reader->next('node3')); 32echo $reader->name . PHP_EOL; 33var_dump($reader->next()); 34echo $reader->name . PHP_EOL; 35var_dump($reader->next('node5')); 36echo $reader->name . PHP_EOL; 37var_dump($reader->next()); 38echo $reader->name . PHP_EOL; 39$reader->close(); 40 41?> 42--EXPECT-- 43Data must be loaded before reading 44Data must be loaded before reading 45node1 46bool(true) 47node3 48bool(true) 49node4 50bool(false) 51 52bool(false) 53