Possible Duplicate:
A simple program to CRUD node and node values of xml file
XPath and PHP: nothing works properly
$XML = <<<XML
<items>
<item id="123">
<name>Item 1</name>
</item>
<item id="456">
<name>Item 2</name>
</item>
<item id="789">
<name>Item 3</name>
</item>
</items>
XML;
$objSimpleXML = new SimpleXMLElement($XML);
echo $objSimpleXML->item[2]->name; // output: Item 3 (OK)
echo '<br><pre>';
print_r($objSimpleXML->xpath('./item[1]/name')); // output: empty Array!!!
Hello! How to get "Item 3" as output using pure xpath query? (My proposal outputs an empty array.)