xml:
xpath()
returns an array, you have to select the first element of that array, at index 0. Attention: if there's no match, it may return an empty array. Therefore, you should add an if (isset($xpath[0]))
clause, just in case.
foreach ($xml->entry as $entry)
{
$xpath = $entry->xpath('./link[@rel="alternate"]/@href');
if (isset($xpath[0]))
{
echo $xpath[0], "\n";
}
}
You were close:
./link[@rel='alternate']/@href
Should be the correct XPath to get those values.