# \[FMX\] Amazon.com API into XML

**URL:** <https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171>\
**Category:** flash\
**Created:** [June 13, 2003, 10:45pm UTC](https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171 "2003-06-13T22:45:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DJ\_Lex](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@DJ\_Lex](https://forum.kirupa.com/u/DJ_Lex)\
**Post date:** [June 13, 2003, 10:45pm UTC](https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171/1 "2003-06-13T22:45:39Z")

</div>

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]](http://xml.amazon.com/onca/xml3?t=webservices-20&dev-t=djlex-20&KeywordSearch=Bolshoi&mode=music&type=heavy&page=1&f=xml%5B/font%5D)

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](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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 14, 2003, 6:29pm UTC](https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171/2 "2003-06-14T18:29:33Z")

</div>

Is this topic not exciting? 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 14, 2003, 6:49pm UTC](https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171/3 "2003-06-14T18:49:01Z")

</div>

Try changing nodeValue to firstChild

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 16, 2003, 4:57pm UTC](https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171/4 "2003-06-16T16:57:15Z")

</div>

lostinbeta,

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 16, 2003, 6:38pm UTC](https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171/5 "2003-06-16T18:38:52Z")

</div>

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](http://kirupa.com) if you want to check them out.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 16, 2003, 6:48pm UTC](https://forum.kirupa.com/t/fmx-amazon-com-api-into-xml/23171/6 "2003-06-16T18:48:19Z")

</div>

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.
