i converted xml string into a simpleXMLElement object using simplexml_load_string whose value on print_r outputs
SimpleXMLElement Object ( [message] => SimpleXMLElement Object ( [@attributes] => Array
( [to] => Danny [type] => greeting [id] => msg1 )
[body] => To be or not to be! ) [status] => SimpleXMLElement Object ( [@attributes] => Array ( [time] => 2015-01-12 ) [0] => SimpleXMLElement Object ( [@attributes] => Array ( [count] => 0 ) ) ))
How can I extract node and attribute values from this object? Using
echo $xml->body
to get content of the body node is not outputting any value
UPDATE:
XML string
<start>
<message to="Danny" type="greeting" id="msg1 ">
<body>
To be or not to be!
</body>
</message>
<status time="2015-01-12">
<offline count="0"></offline>
</status>
</start>
Would like to extract both the node values and attributes