Index: trunk/parsers.php
===================================================================
--- trunk/parsers.php	(revision 304726)
+++ trunk/parsers.php	(working copy)
@@ -11,13 +11,19 @@
  */
 class WXR_Parser {
 	function parse( $file ) {
-		if ( extension_loaded( 'simplexml' ) )
+		if ( extension_loaded( 'simplexml' ) ) {
 			$parser = new WXR_Parser_SimpleXML;
-		else if ( extension_loaded( 'xml' ) )
+			$result = $parser->parse( $file );
+			if ( ! is_wp_error( $result ) || 'SimpleXML_parse_error' != $result->get_error_code() )
+				return $result;
+		} else if ( extension_loaded( 'xml' ) ) {
 			$parser = new WXR_Parser_XML;
-		else
-			$parser = new WXR_Parser_Regex;
+			$result = $parser->parse( $file );
+			if ( ! is_wp_error( $result ) || 'XML_parse_error' != $result->get_error_code() )
+				return $result;
+		}
 
+		$parser = new WXR_Parser_Regex;
 		return $parser->parse( $file );
 	}
 }
@@ -208,7 +214,7 @@
 
 		if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {
 			$current_line = xml_get_current_line_number( $xml );
-			$current_column = xml_get_current_column_number( $xml );		
+			$current_column = xml_get_current_column_number( $xml );
 			$error_code = xml_get_error_code( $xml );
 			$error_string = xml_error_string( $error_code );
 			return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( $current_line, $current_column, $error_string ) );
