To get array of messages you can use xpath:
$xml1 = $xml1->xpath('//message');
$xml2 = $xml2->xpath('//message');
, and then loop through array to compare them.
EDIT:
Code for loop, extract names from array and intersect them:
$messages1 = array();
array_map(
function($message) use (&$messages1) {
$messages1[(string) $message->appid] = (array) $message;
},
$xml1
);
$messages2 = array();
array_map(
function($message) use (&$messages2) {
$messages2[(string) $message->appid] = (array) $message;
},
$xml2
);
$result = array_intersect_key( $messages1, $messages2 );
foreach ( $result as $value ) {
echo '<img src="http://media.steampowered.com/steamcommunity/public/images/apps/'. htmlentities($value['appid']) .'/'. htmlentities($value['img_logo_url']) .'.jpg">';
}
Hope it helps.