JSON - XML解码问题

Hi I'm trying to make a simple list, based on the response of a CURL XML. The problem I see is when I convert yo JSON, with json_decode, I have some arrays with 2 or 3 elemtns, and sometime only 1, and when is it only one I have and error message, and I do not know how to validate this issue. Here is my PHP script :

enter code here
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_MUTE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);

$xml = simplexml_load_string($output);
$json = json_encode($xml);
$arr = json_decode($json,true);

$hoteles = count($arr['ServiceHotel']);

for ($x = 0; $x <= $hoteles; $x++) {
     $hotel = $arr['ServiceHotel'][$x]['HotelInfo']['Name'] ;
     $room_count =  count($arr['ServiceHotel'][$x]['AvailableRoom'][0]['HotelRoom']['RoomType']); 
for ($y = 0; $y <= $room_count; $y++) {
    if($room_count == 0){
        $room_type  = $arr['ServiceHotel'][$x]['AvailableRoom']['HotelRoom']['RoomType'] ;
        $board      = $arr['ServiceHotel'][$x]['AvailableRoom']['HotelRoom']['Board'] ;
        $rate       = $arr['ServiceHotel'][$x]['AvailableRoom']['HotelRoom']['Price']['Amount'] ;
    }else{
        $room_type  = $arr['ServiceHotel'][$x]['AvailableRoom'][$y]['HotelRoom']['RoomType'] ;
        $board      = $arr['ServiceHotel'][$x]['AvailableRoom'][$y]['HotelRoom']['Board'] ;
        $rate       = $arr['ServiceHotel'][$x]['AvailableRoom'][$y]['HotelRoom']['Price']['Amount'] ;   
    }    
print "[$x]Hotel :  $hotel <br> Room Type : $room_type > $board > $rate <hr> ";
}

This is the result I'm trying to get:

Hoteles: 19 
Rooms: 1 
[0]Hotel : Posada Los Arcos Holbox 
Room Type : DOUBLE ECONOMY > ROOM ONLY > 800.000
[0]Hotel : Posada Los Arcos Holbox 
Room Type : DOUBLE STANDARD > ROOM ONLY > 1000.000
Rooms: 1 
[1]Hotel : Hacienda de Castilla 
Room Type : DOUBLE STANDARD > ROOM ONLY > 838.500
[1]Hotel : Hacienda de Castilla 
Room Type : DOUBLE STANDARD > AMERICAN BREAKFAST > 1126.740
Rooms: 1 
[2]Hotel : Hacienda de Castilla 
Room Type : DOUBLE STANDARD > ROOM ONLY > 890.900
[2]Hotel : Hacienda de Castilla 
Room Type : DOUBLE STANDARD > AMERICAN BREAKFAST > 1179.140

But when the [AvailableRoom] array has only one item, I'm receiving this error: Notice: Undefined offset: 0 in C:\wamp\www

In advance thank you, for any help !!