Add exception handling for XML errors.