|
@@ -3814,6 +3814,32 @@ THREE.ColladaLoader.prototype = {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // convert the parser error element into text with each child elements text
|
|
|
|
+ // separated by new lines.
|
|
|
|
+ function parserErrorToText( parserError ) {
|
|
|
|
+
|
|
|
|
+ var result = '';
|
|
|
|
+ var stack = [ parserError ];
|
|
|
|
+ while ( stack.length ) {
|
|
|
|
+
|
|
|
|
+ var node = stack.shift();
|
|
|
|
+ if ( node.nodeType === Node.TEXT_NODE ) {
|
|
|
|
+
|
|
|
|
+ result += node.textContent;
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ result += '\n';
|
|
|
|
+ stack.push.apply( stack, node.childNodes );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result.trim();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
if ( text.length === 0 ) {
|
|
if ( text.length === 0 ) {
|
|
|
|
|
|
return { scene: new THREE.Scene() };
|
|
return { scene: new THREE.Scene() };
|
|
@@ -3827,7 +3853,21 @@ THREE.ColladaLoader.prototype = {
|
|
var parserError = xml.getElementsByTagName( 'parsererror' )[ 0 ];
|
|
var parserError = xml.getElementsByTagName( 'parsererror' )[ 0 ];
|
|
if ( parserError !== undefined ) {
|
|
if ( parserError !== undefined ) {
|
|
|
|
|
|
- console.error( 'ColladaLoader: Failed to parse collada file.', parserError );
|
|
|
|
|
|
+ // Chrome will return parser error with a div in it
|
|
|
|
+ var errorElement = getElementsByTagName( parserError, 'div' )[ 0 ];
|
|
|
|
+ var errorText;
|
|
|
|
+ if ( errorElement ) {
|
|
|
|
+
|
|
|
|
+ errorText = errorElement.textContent;
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ errorText = parserErrorToText( parserError );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.error( 'ColladaLoader: Failed to parse collada file.\n', errorText );
|
|
|
|
+
|
|
return null;
|
|
return null;
|
|
|
|
|
|
}
|
|
}
|