Hi, all.
when i run my code, i always got the xpath Invalid expression warning.
So here is my question:
Assume i have the xml file
<root>
<items>
<item id="1">
<name>
item1
</name>
</item>
<item id="2">
<name>
item2
</name>
</item>
</items>
</root>
And here is my php code
<?php
$id = $_GET['id'];
$xml = new SimpleXMLElement(file_get_contents('item.xml'));
$item = $xml->xpath("/root/./.[@id='{$id}']"); //want to go to the item
$items = $item->xpath("../..");//want to go to the items
?>
So I got the xpath invalid expression warnings and also for the go to the parent node part got the error. ???
Somebody could help me??
Thanks.