[FMX] Amazon.com API into XML

Hi Folks!

I’m 99% there but I missing something and have spent to much time trying to get this to work. Hopefully someone can point out my obvious mistake…

The XML document I’m testing with:

[font=courier]http://xml.amazon.com/onca/xml3?t=webservices-20&dev-t=djlex-20&KeywordSearch=Bolshoi&mode=music&type=heavy&page=1&f=xml[/font]

I’m trying to target the < ImageUrlSmall >:

[font=courier]function amazonLoad() {
amazonimage = (amazonXML.childNodes[0].childNodes[3].childNodes[6]);
}[/font]

When I trace amazonimage I get:

[font=courier]< ImageUrlSmall >http://images.amazon.com/images/P/B00002DF9J.01.THUMBZZZ.jpg< /ImageUrlSmall >[/font]

When I add the .nodeValue:

[font=courier]function amazonLoad() {amazonimage = (amazonXML.childNodes[0].childNodes[3].childNodes[6].nodeValue);
}[/font]

amazonimage traces as null.

So, how do I get just the value?

Thanks,
Lex

Is this topic not exciting? :wink:

Try changing nodeValue to firstChild

lostinbeta,

That did the trick! Thanks! Where’s your tip jar? :wink:

So, can you explain why firstChild gives me the data and not nodeValue?

nodeValue returns the nodeType value of the current XML node, I believe it returns 1, or 3. Where 1 means it is an XML Element and 3 means it is a text node. Or something along those lines.

firstChild gets the value of the first child inside the parent node. In this case your parent node childNodes[6] , and the firstChild in childNodes[6] would be the text contained within that nodes tag (given there are no more nodes within that childNode).

I am VERY bad at explaining stuff like this, there are a few XML in Flash tutorial at kirupa.com if you want to check them out.

BTW, I’ll be using this code to display the current playing album artwork in my banner combined with the other dynamic data from my webcast.