# XML Load to Array Problems

**URL:** <https://forum.kirupa.com/t/xml-load-to-array-problems/252737>\
**Category:** flash\
**Created:** [February 22, 2008, 11:08pm UTC](https://forum.kirupa.com/t/xml-load-to-array-problems/252737 "2008-02-22T23:08:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmwagner](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@cmwagner](https://forum.kirupa.com/u/cmwagner)\
**Post date:** [February 22, 2008, 11:08pm UTC](https://forum.kirupa.com/t/xml-load-to-array-problems/252737/1 "2008-02-22T23:08:19Z")

</div>

I was searching online, and well found this forum - specifically this thread on Kirupa ([http://kirupa.com/forum/showthread.php?p=2210051](http://kirupa.com/forum/showthread.php?p=2210051)). So, I followed SoulWire’s instructions (even though they confused what the original poster wanted) because it worked, and they explained it well.

Unfortunately, I tried to run it - hoping to see the output window pop up, and list my verses. (Don’t ask me why the client wants scripture verses popping up on his business site - he just does).

So, here’s the code as I modified it. Can someone see why it might not be working?

```php
var verseArray:Array = new Array();
function testData() {
    for (var i:Number = 0; i<cars.length; i++) {
        var verse:Object = verseArray*;
        trace("----------------------------");
        trace("This is Verse number "+i);
        trace("Verse Quote: "+verse.passage);
        trace("Quote Reference: "+verse.quoteref);
    }
}
function parseXML(data:XML) {
    var count:Number = data.firstChild.childNodes.length;
    for (var i:Number = 0; i<count; i++) {
        var node:Array = data.firstChild.childNodes*;
        var verse:Object = new Object();
        var n:Number = 0;
        verse.passage = node.childNodes[n++].firstChild.toString();
        verse.quoteref = node.childNodes[n++].firstChild.toString();
        verseArray.push(verse);
    }
    testData();
}
var verseData:XML = new XML();
verseData.ignoreWhite = true;
verseData.onLoad = function(ok:Boolean) {
    if (ok) {
        parseXML(this);
    } else {
        trace("Error loading XML!");
    }
};
verseData.load("../verses.xml");

```

Thanks in advance!

Cat
