使用phonegap在jquery mobile中加载大型xml文件时,如何减少加载时间 I'm on creating jquery mobile app in phonegap 0.9.6. intend to create array type of
使用phonegap在jquery mobile中加载大型xml文件时,如何减少加载时间 I'm on creating jquery mobile app in phonegap 0.9.6. intend to create array type of json object after loading xml data like this '[{"a":"val01", "b":"val02"}, {"a":"val03", "b":"val04"}, ...]'. a, b are column name. but taking a so long time(14 secs) in case of loading large size xml data. - first xml - size : 1.45MB, time : 13.54s (4013 rows, 11 columns) - second xml - size : 827.15KB, time : 59ms (3128 rows, 6 columns) first xml is just below double size of second xml. but loading time is not double. I don't know why loading first xml takes so long time. So I need your help and advice. thanks.使用phonegap在jquery mobile中加载大型xml文件时,如何减少加载时间 I'm on creating jquery mobile app in phonegap 0.9.6. intend to create array type of,jquery,xml,json,Jquery,Xml,Json,使用phonegap在jquery mobile中加载大型xml文件时,如何减少加载时间 I'm on creating jquery mobile app in phonegap 0.9.6. intend to create array type of json object after loading xml data like this '[{"a":"val01", "b":"val02"}, {"a":"val03", "b":"val04"}, ...]'. a, b are co
function CreateObj() {
var arr = [];
var colCnt = $(inputXML).find('RECORD').first().children().length; //column length
//loop rows count
$(inputXML).find('RECORD').each(function() {
var row = {};
for (var i = 0; i < colCnt; i++) {
row[columnName] = Trim(columnValue);
}
arr.push(row);
});
return arr; }
function LoadXMLData(file) {
$.ajax({
type: "GET",
url: "data/" + file + ".xml",
dataType: "xml",
async: true,
error: function(xhr, status, err) {
var errMsg = (err) ? xhr + "\n" + status + ":" + err : "";
navigator.notification.alert(errMsg + "\nData not loaded. Retry This App", onAlert);
},
success: function(data, status, xhr) {
xmlDocs[file] = CreateObj();
}
}); }