Fix XML error handling for PHP 5.3