Error: Every other traced XMLnode is a "," o.0?

I’m trying to just create a picture gallery using an XML file. Just for practice purposes. Everything seems to work fine. However, when I try retrieve data within certain childNodes I get an undefined value. Tracing these exact nodes reveals an output of " , ". Ignore white is set to true. Any ideas why this may be so?

Before you look at the code:
A lot of it is really unncessary. I placed it all here just incase. The error can be basically summed by this:

Frame 1:
stop();
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function() {
_root.gotoAndStop(2);
}
gallery_xml.load(“gallery.xml”);

Frame 2:
stop();

var cars = new XML(gallery_xml.firstChild.childNodes);
cars.ignoreWhite = true;
pics.ignoreWhite = true;
for (i = 0; i < 5; i++) {
trace (cars.childNodes*);
}
OUTPUT:
<car model=“Car 1” preview=“civic_preview.jpg”><picture>civic1.jpg</picture></car>
,
<car model=“Car 2” preview=“lancer_preview.jpg”><picture>lancer1.jpg</picture><picture>lancer2.jpg</picture></car>
undefined
undefined

Where does this " , " come from? This keeps coming up inbetween my latter documents as the FIRST nodes value and every other after that. It’s annoying :confused:

Please help ^^

Here is the XML file:
<?xml version=“1.0”?>
<gallery>
<car model=“Car 1” preview=“civic_preview.jpg”>
<picture>civic1.jpg</picture>
</car>
<car model=“Car 2” preview=“lancer_preview.jpg”>
<picture>lancer1.jpg</picture>
<picture>lancer2.jpg</picture>
</car>
</gallery>

Here is the code:
Frame 1:
stop();

var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;

gallery_xml.onLoad = function() {
gotoAndStop(2);
}

gallery_xml.load(“gallery.xml”);

Frame 2:
stop(); //stop playing
var cars = new XML(gallery_xml.firstChild.childNodes); //stores all car pictures
cars.ignoreWhite = true; //ignore white spaces

//returns the x center
function findcenterx(food_mc:MovieClip) {
return (food_mc._width / 2);
}

//returns the number of first level child elements
function getchildNodes(thexml:XML) {
var numchilds:Number = 0; //number of child elements
var j:Number = 0; //stores the current child element
//while there is a next sibling
while (thexml.childNodes[j].nextSibling != null) {
//if the current node is an element node
if (thexml.childNodes[j].nodeType == 1) {
numchilds++; //increase the count of the number of childs
}
j++;
trace (thexml.childNodes[j]);
}
return numchilds;
}

//removes all pictures
function removepictures() {
picarea_mc.pic0.removeMovieClip();
picarea_mc.pic1.removeMovieClip();
picarea_mc.pic2.removeMovieClip();
picarea_mc.pic3.removeMovieClip();
picarea_mc.pic4.removeMovieClip();
picarea_mc.pic5.removeMovieClip();
}

//generates the gallery preview pictures and the event handlers
//for the gallery of car pictures
var numcars:Number = getchildNodes(cars); //stores the number of cars
var centerx = findcenterx(carnav_mc); //finds the center of the car preview menu
//for as long as i is less or equal to than the total number of cars
for (i = 0; i <= numcars; i++) {
//attach a movie to the preview menu with an instance name
newpreview_mc = carnav_mc.attachMovie(“preview”, “car” + i, i);
newpreview_mc._x = centerx;
//sets the y position of the preview picture
if (i == 0) {
newpreview_mc._y = newpreview_mc._height / 2 + 10;
} else {
newpreview_mc._y = (newpreview_mc._height / 2 + 10) + (newpreview_mc._height + 10) * (i);
}
loadMovie(cars.childNodes*.attributes.preview,newpreview_mc.image_mc);
//onRelease event for the preview pictures
//displays the pictures of that clicked preview car
newpreview_mc.onRelease = function () {
removepictures();
var pics = new XML(gallery_xml.firstChild.childNodes[Number(this._name.charAt(this._name.length - 1))].childNodes);
var numpics:Number = getchildNodes(pics);
for (j = 0; j <= numpics; j++) {
newpicture_mc = picarea_mc.attachMovie(“preview”, “pic” + j, j);
newpicture_mc._y = newpicture_mc._height / 2 + 10;
if (j == 0) {
newpicture_mc._x = newpicture_mc._width / 2 + 10;
} else if (j >= 1 && j < 3) {
newpicture_mc._x = (newpicture_mc._width / 2 + 10) + (newpicture_mc._width + 10) * (j);
} else {
newpicture_mc._x = (newpicture_mc._width / 2 + 10) + (newpicture_mc._width + 10) * (j - 3);
newpicture_mc._y = (newpicture_mc._height / 2 + 10) + (newpicture_mc._height + 10);
}
//shows the picture? O.0
loadMovie(pics.childNodes[j].childNodes[0].nodeValue,newpicture_mc.image_mc);
}
}
}