<?php

$xmlr = new XMLREADER();
if (!$xmlr->open('xml/books.xml')) {
    die('failed to open xml/books.xml');
}
echo "<pre>author\t\tbook</pre>";
while ($xmlr->read()) {
    if ($xmlr->name === 'author') {
        echo $xmlr->readString() . "-";
    } elseif ($xmlr->name === 'title') {
        echo $xmlr->readString() . "<br/>";
    }
}
<?php

$reader = new XMLREADER();
$reader->open('articles.xml');
while ($reader->read()) {
    if ($reader->nodeType == XMLREADER::ELEMENT) {
        print "local name = " . $reader->localName . "<br>";
        print "name = " . $reader->name . "<br>";
        print "value = " . $reader->nodevalue . "<br>";
    }
}