how do I parse this in PHP
I am using simpleXML and get back the result like so:
SimpleXMLElement Object ( [@attributes] => Array ( [minorVersion] => 3 [majorVersion] => 3 [inferiorVersion] => 0 ) )
I would appreciate if I can get some help parsing this information开发者_StackOverflow社区 - I have tried $xml(the oblect) like $xml->@attributes[minorVersion] but do not get anything back
Thanks
This is because the nodes are objects. One thing you can do is call the attributes() method which returns you an array. Make sure you always cast the result to an appropriate php type like (string), especially when doing comparisons.
$t = $xml->node->attributes();
echo (string) $t['minorVersion'];
You could also just try referencing it directly:
echo (string) $xml->node['minorVersion'];
精彩评论