I am trying to import an xml file into an xml object but everytime that I access the node that I want to put into an array element using the .nodeValue the trace returns null. When I don’t put the nodeValue on the end it returns the entire node xml tags and all.
I know that I’m doing something fundamentally wrong here I just don’t quite know what since xml/flash is new to me. Any help will be greatly appreciated!
Thanks!
schutzy
Here’s the datasource url
[COLOR=#22229c]http://www.hunkdish.com/upload/products.xml[/COLOR]
Here’s the code
products_xml = new XML();
products_xml.onLoad = initializeXML;
products_xml.load(“http://www.hunkdish.com/upload/products.xml”);
products_xml.ignoreWhite = true;
var productnames = new Array();
var prices = new Array();
function initializeXML(success) {
if (success)
{
rootNode = products_xml.firstChild;
mediatype = rootNode.firstChild.firstChild[1];
numElements = rootNode.childNodes.length;
for(i = 0 ; i < numElements ; i++){
productnames* = rootNode.childNodes*.attributes.name;
trace(productnames*);// outputs the product’s name
/*
prices* = rootNode.childNodes*.childNodes[2].nodeValue; // returns the node but with the xml tags
trace prices*);
/
prices = rootNode.childNodes*.childNodes[2].nodeValue; // this always returns null
trace(prices*);
}// end for
}// end if
}// end function