Anyone understand why this isn't returning anything?
<?php
$reader = new XMLReader();
$reader->open('file.xml');
while($reader->read())
{
if($reader->nodeType == XMLREADER::ELEMENT && $reader->localName == 'headend')
{
$reader->read();
$headend = (string)$reader->getAttribute('headendId');
echo $headend;
}
}
(xml is as followed)
<lineup>
<headend headendId="something">
<name>some name</name>
<ids>ids</ids>
<codes>codes</codes>
</headend>
</lineup>