# XML Parsing Problem - nodeValue returns null instead of text

**URL:** <https://forum.kirupa.com/t/xml-parsing-problem-nodevalue-returns-null-instead-of-text/209563>\
**Category:** flash\
**Created:** [December 10, 2006, 8:29am UTC](https://forum.kirupa.com/t/xml-parsing-problem-nodevalue-returns-null-instead-of-text/209563 "2006-12-10T08:29:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![schutzy](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@schutzy](https://forum.kirupa.com/u/schutzy)\
**Post date:** [December 10, 2006, 8:29am UTC](https://forum.kirupa.com/t/xml-parsing-problem-nodevalue-returns-null-instead-of-text/209563/1 "2006-12-10T08:29:03Z")

</div>

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]](http://www.hunkdish.com/upload/products.xml)

Here’s the code

products\_xml = new XML();  
products\_xml.onLoad = initializeXML;  
products\_xml.load(“[http://www.hunkdish.com/upload/products.xml](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
