I have a file that looks like this:
About.com: Animation Guide
It'll take time and proper debugging to come up with working pure XMLReader code. Meanwhile try this hybrid method:
$xmlR = new XMLReader;
$xmlR->open('dbpedia/links/xml.xml');
//Skip until node
while ($xmlR->read() && $xmlR->name !== 'ExternalPage');
$loadedNS_f = false;
while ($xmlR->name === 'ExternalPage')
{
//Read the entire parent tag with children
$sxmlNode = new SimpleXMLElement($xmlR->readOuterXML());
//collect all namespaces in node recursively once; assuming all nodes are similar
if (!$loadedNS_f) {
$tagNS = $sxmlNode->getNamespaces(true);
$loadedNS_f = true;
}
$URL = (string) $sxmlNode['about'];
$dNS = $sxmlNode->children($tagNS['d']);
$Title = (string) $dNS->Title;
$Desc = (string) $dNS->Description;
$Topic = (string)$sxmlNode->topic;
var_dump($URL, $Title, $Desc, $Topic);
// Jump to next tag
$xmlR->next('ExternalPage');
}
$xmlR->close();