xml - How to loop through a huge XMLList without any lag? -


i have xml list contains around 50000 items.when search something, use loop loop through elements.. works app becomes unresponsive 4 seconds. there faster way this?

if search should use xml search methods instead of looping through yourself.

for example this:

var searchresult:xmllist = xmldata.*.(name == "search"); searchresult = xmldata.*.(name == "search" || name == "other");//more example searchresult = xmldata.*.(name == "search" && @type == "attribute");//more example 

returns elements name tag content "search". can attributes well, etc ... can write complex search logic , results without loops.

if absolutely must loop need break loop steps. keep iterator reference , set max loop number, like:

var iterator:int = 0; var maxloop:int = 1000; var timer:timer = etc ... timer.start(); 

now each timer tick loop through xml starting @ "iterator" , ending @ "maxloop" increase "iterator" maxloop , run second timer tick etc ... won't make overall loop faster stop app idling. can display progress bar.

edit: deleting xmllist.

if need delete xmllist index , delete parent. taking example above , assuming 1 element returned (if more 1 use loop) , xmldata root parent of name xmllist:

var elementindex:int = searchresult.childindex(); delete xmldata.name[elementindex]; 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -