Hi, I need to find the parent attribute of a node, if anyone can help
If child = foo1 parent['att']=def
so far i have
but this returns every parent of a child ie. all of them, whereas I require just the parent of the node with the content foo1
Code:
<uniquenode>
<parent att="abc">
<child>foo</child>
<child>bar</child>
</parent>
<parent att="def">
<child>foo1</child>
<child>bar1</child>
</parent>
</uniquenode>
so far i have
Code:
$word=$xml->xpath("//child");
foreach ($word as $whatever) {
if($whatever=='foo1'){....