src/tilesource.js
function processResponse( xhr ){
    var responseText = xhr.responseText,
        status       = xhr.status,
        statusText,
        data;

    if ( !xhr ) {
        throw new Error( $.getString( "Errors.Security" ) );
    } else if ( xhr.status !== 200 && xhr.status !== 0 ) {
        status     = xhr.status;
        statusText = ( status == 404 ) ?
            "Not Found" :
            xhr.statusText;
        throw new Error( $.getString( "Errors.Status", status, statusText ) );
    }

    if( responseText.match(/\s*<.*/) ){
        try{
        data = ( xhr.responseXML && xhr.responseXML.documentElement ) ?
            xhr.responseXML :
            $.parseXml( responseText );
        } catch (e){
            data = xhr.responseText;
        }
    }else if( responseText.match(/\s*[\{\[].*/) ){
        try{
          data = $.parseJSON(responseText);
        } catch(e){
          data =  responseText;
        }
    }else{
        data = responseText;
    }
    return data;
}
function processResponse( xhr ){
    var responseText = xhr.responseText,
        status       = xhr.status,
        statusText,
        data;

    if ( !xhr ) {
        throw new Error( $.getString( "Errors.Security" ) );
    } else if ( xhr.status !== 200 && xhr.status !== 0 ) {
        status     = xhr.status;
        statusText = ( status == 404 ) ?
            "Not Found" :
            xhr.statusText;
        throw new Error( $.getString( "Errors.Status", status, statusText ) );
    }

    if( responseText.match(/\s*<.*/) ){
        try{
        data = ( xhr.responseXML && xhr.responseXML.documentElement ) ?
            xhr.responseXML :
            $.parseXml( responseText );
        } catch (e){
            data = xhr.responseText;
        }
    }else if( responseText.match(/\s*[\{\[].*/) ){
        try{
          data = $.parseJSON(responseText);
        } catch(e){
          data =  responseText;
        }
    }else{
        data = responseText;
    }
    return data;
}
function processResponse ( xhr ) { var responseText = xhr . responseText , status = xhr . status , statusText , data ; if ( ! xhr ) { throw new Error ( $ . getString ( "Errors.Security" ) ) ; } else if ( xhr . status !== 200 && xhr . status !== 0 ) { status = xhr . status ; statusText = ( status == 404 ) ? "Not Found" : xhr . statusText ; throw new Error ( $ . getString ( "Errors.Status" , status , statusText ) ) ; } if ( responseText . match ( / \s*<.* / ) ) { try { data = ( xhr . responseXML && xhr . responseXML . documentElement ) ? xhr . responseXML : $ . parseXml ( responseText ) ; } catch ( e ) { data = xhr . responseText ; } } else if ( responseText . match ( / \s*[\{\[].* / ) ) { try { data = $ . parseJSON ( responseText ) ; } catch ( e ) { data = responseText ; } } else { data = responseText ; } return data ; }
Decides whether to try to process the response as xml, json, or hand back
the text
@private
@inner
@function
@param {XMLHttpRequest} xhr - the completed network request
Decides whether to try to process the response as xml json or hand back the text