Hello all
I have a question to ask you all.
I have this xml document thats created via php that looks like this.
(note: sample of the xml not full.)
<?xml version="1.0" encoding="ISO-8859-1"?>
<cms_item>
<product_item>
<product_id>1</product_id>
<product_name>chairs</product_name>
</product_item>
<collection_item>
<collection_id>1</collection_id>
<collection_name>chairs collection</collection_name>
</collection_item>
</cms_item>
This is created from a database and the xml is the a combination of the two data tables.
Now i have created a class file which can read this xml data or any xml doc in that format of childNodes and what not and return the results as an array.
This works great and beautifull done (i’m impressed with myself sorry :))
Now i’ve done this like this.
//bumfph to load the xml document and create arrays and all that gumfph blah blah blah
var colNumber:Number = 0;
var proNumber:Number = 0;
//
function splitCategories() {
var catLength:Number = categoriesArray.length;
for (var i = 0; i<catLength; ++i) {
//trace(i);
if (!categoriesArray*['collection_id']) {
productArray[proNumber] = new Object();
productArray[proNumber]["product_id"] = categoriesArray*["product_id"];
productArray[proNumber]["product_name"] = categoriesArray*["product_name"];
proNumber += 1;
} else {
collectionArray[colNumber] = new Object();
collectionArray[colNumber]["collection_id"] = categoriesArray*["collection_id"];
collectionArray[colNumber]["collection_name"] = categoriesArray*["collection_name"];
colNumber += 1;
}
}
}
Is it better to work straight from the xml object or from the array. and is there a better way of doing this so its a lean mean array creating machine?
Many thanks