i.e. - i want to return a string "yellow" using something like xpath expression "//banana/@color" and the following example xml...
<fruits> <kiwi color="green" texture="hairy"/> <banana color="yellow" texture="waxy"/> </fruits> $fruits = simplexml_load_string( '<fruits> <kiwi color="green" texture="hairy"/> <banana color="yellow" texture="waxy"/> </fruits>'); print_r($fruits->xpath('//banana/@color')); produces
Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [color] => yellow ) ) ) whereas i would prefer something like...
Array ( [0] => SimpleXMLElement Object ( [0] => yellow ) ) ...so that i don't need to write a special case into the application i'm writing.
thanks very much! :)