XML Design with Large Datasets for ActionScript3
I have a very large XML file that has 40,000 data, and when I try to load XML using ActionScript3 and then populate the data in an array, I get the following error:
A script took longer than the default timeout period of 15 seconds.
Is there a way to get around this timeout issue? Here is an example XML
<Map>
<Data>0</Data>
<Data>1</Data>
<Data>2</Data>
<Data>3</Data>
// continue for many many times
<Data>39999</Data>
</Map>
The line break seems to be in the for loop. The code is like this
var aNumberArray:Array = new Array( 200 * 200 );
var nRowIndex:int = 0;
for ( ; 200 > nRowIndex; ++nRowIndex ) {
var nColumnIndex:int = 0;
for ( ; 200 > nColumnIndex; ++nColumnIndex ) {
var nIndex:int = nColumnIndex + nRowIndex * 200;
// assume cXMLMap is already a pre read XML class
aNumberArray[ nIndex ] = new int( cXMLMap.Data[ nIndex ] );
}
}
I suspect it cXMLMap.Data[ nIndex ]
takes a long time to get the variable from XML. Please advice.
0
a source to share
1 answer
I found the answer, I need to change the XML format to something like below
// given a data set of 200 X 200 fields
<Map>
<Data>00 10 20 30 40 ..... 1990</Data>
<Data>00 11 21 31 41 ..... 1991</Data>
// repeat until reach 200 times
<Data>2000 2001 2002 2003 2004 ..... 199200</Data>
</Map>
This will reduce the XML parsing time, however I need to write some code to tokenize the string in actionscript3.
0
a source to share