SimpleXML, XPath: how to get content of element by unique id?

azonic

New Member
kept trying for hours, brain messed up, need help:XML-file:\[code\]<?xml version="1.0" encoding="UTF-8"?><testresult> <body> <itemset name="sc"> <item name="1">1</item> <item name="2">3</item> <item name="3">0</item> </itemset> </body></testresult>\[/code\]Now I want to retrieve the content (0) of the item with the unique name "3" into $value...\[code\]$value=http://stackoverflow.com/questions/14617034/$resultxml->xpath("//item[@name='$name']");\[/code\]unfortunately not... what do I need to do to get $value=http://stackoverflow.com/questions/14617034/0?Thank you in advance,Michi
 
Back
Top