# Problems accessing nodeValue of XML file

**URL:** <https://forum.kirupa.com/t/problems-accessing-nodevalue-of-xml-file/89277>\
**Category:** Uncategorized\
**Created:** [May 6, 2005, 4:48pm UTC](https://forum.kirupa.com/t/problems-accessing-nodevalue-of-xml-file/89277 "2005-05-06T16:48:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yodaa](https://avatars.discourse-cdn.com/v4/letter/y/e19adc/32.png) [@yodaa](https://forum.kirupa.com/u/yodaa)\
**Post date:** [May 6, 2005, 4:48pm UTC](https://forum.kirupa.com/t/problems-accessing-nodevalue-of-xml-file/89277/1 "2005-05-06T16:48:29Z")

</div>

Hi,

I’m building a gallery under flash mx 2004. I use an xml file to store the description about each painting that has to be displayed with the picture related to it.

Here is my xml file :

```auto

<description>
	   <painting ref="01">
			  <title>Guernica</title>
			  <date>1937</date>
			  <technique>Peinture à l'huile</technique>
			  <size>3,51 m. x 7,82 m</size>
	   </painting>
	   <painting ref="02">
			  <title>ceci est une croute</title>
			  <date>2005</date>
			  <technique>Gouache</technique>
			  <size>21X29,7 cm</size>
	   </painting>
</description>

```

1 ) Here is a the as2 code on my button :

[AS]on (release) {  
var img = “01”;  
load\_img (img);  
}  
[/AS]

2 ) Here is my as2 function loading the xml file :

[AS]  
function load\_description (ref\_img:String) {  
// … code loading the picture…getting the “id” of it by the parameter “ref\_img”…  
var my\_xml\_description:XML = new XML ();  
my\_xml\_description.ignoreWhite = true;  
my\_xml\_description.load (“xml/description.xml”);  
my\_xml\_description.onLoad = function (success) {  
if (success) {  
affiche\_description (this, ref\_img);  
} else {  
trace (“loading error”);  
}  
}  
}  
[/AS]

3 ) Here is the as2 function wich intended to display informations about the picture stored in the “description.xml” file :

[AS]function affiche\_description (node\_xml:XML, reference:String) {  
trace ("node\_xml.childNodes[0].nodeName : " + node\_xml.childNodes[0].nodeName);  
trace ("node\_xml.childNodes[0].childNodes[0].nodeName : " + node\_xml.childNodes[0].childNodes[0].nodeName);  
trace ("node\_xml.childNodes[0].childNodes[0].childNodes[0].nodeName : " + node\_xml.childNodes[0].childNodes[0].childNodes[0].nodeName);  
trace ("node\_xml.childNodes[0].childNodes[0].childNodes[0].nodeValue : " + node\_xml.childNodes[0].childNodes[0].childNodes[0].nodeValue);  
[/AS]

4 ) The problem is that

I can get the node names but the node value is “null”, and the nodeType of my node “\<title\>” returns “1”…

What’s going wrong, it’s supposed to be a text node…

How should I acess to the value of my “\<title\>”,"\<date\>", “\<technique\>”, and “\<size\>” node values ?

## Thanx for your help

Regards
