Assigning XML Text

Hi,

Having issues getting the XML text assigned to the proper fields. “Undefined” is being returned. Any help would be appreciated.


//Create XML Object
var aquentDoc:XML = new XML();
aquentDoc.ignoreWhite = true;
//event handler
aquentDoc.onLoad = function(success:Boolean):Void  {
	if (!success) {
		trace("Failure Loading aquentDoc XML");
		return;
	}
	//validating the xml file             
	if (this.status != 0) {
		trace("This xmlObject is not well-formed: "+this.status);
		return;
	}
	//Error check - xml data okay!            
	if (this.firstChild.nodeName.toLowerCase() != "aquentdoc") {
		trace("Unexpected XML data: "+this.firstChild.nodeName);
		return;
	}
	//Extract elements into an array.           
	var elements_arr = this.firstChild.childNodes;
	for (var i = 0; i<elements_arr.length; i++) {
		//trace(elements_arr*);
		if (elements_arr*.attributes["id"] != null) {
			var headers = elements_arr*.attributes["id"];
			//trace(headers);
			assignText();
		} else {
			var content = elements_arr*;
			//trace(content);
		}
	}
};
//Load the document
aquentDoc.load("./aquentDoc.xml");



function assignText():Void {
	for (var p in this) {
		if (this[p] instanceof TextField) {
			//Show each field's name
			//trace("found "+this[p]._name);
			if (this[p]._name == "header01_txt") {
				header01_txt.text = elements_arr[0].attributes["id"];
			} else if (this[p]._name == "header02_txt") {
				header02_txt.text = elements_arr[1].attributes["id"];
			} else if (this[p]._name == "header03_txt") {
				header03_txt.text = elements_arr[2].attributes["id"];
			}
		}
	}
}