Check if element exists in the returned XML before accessing it