Reputation: 10643
I have an xml file and a flash file. The flash file reads the xml file.
<?xml version="1.0" standalone="yes"?>
<banners>
<banner>
<title>Hello World</title>
<image>http://www.search-this.com/wp-content/themes/big-blue/images/company-logos1.gif</image>
<link>http://google.com/</link>
</banner>
</banners>
Now this works:
trace(this.childNodes[0].childNodes[0].childNodes[0]);
^ shows <title>Hello World</title>
But this shows NULL:
trace(this.childNodes[0].childNodes[0].childNodes[0].nodeValue);
Why is it showing NULL?
Upvotes: 1
Views: 785
Reputation: 82724
Try this:
trace(this.childNodes[0].childNodes[0].childNodes[0].childNodes[0].nodeValue);
//--------------------------------------------------^ another childNodes
Reason: The text itself is a so-called text node. It is a child of the title element (an "element node").
Cheers,
Upvotes: 2