Instead of getElementsByTagName('media:thumbnail'), you need to use  
getElementsByTagNameNS().  The reason for this is that the tagName for  
the element you're looking for is really just "thumbnail."  "media"  
represents the namespace in which the browser will find the tag's  
definition.  For the sake of cross-browser compatibility, you'll  
probably want to use the getElementsByTagNameNS included in the Feeds  
API.  Its usage is outlined in the documentation at the link below:

http://code.google.com/apis/ajaxfeeds/documentation/reference.html#getElementsByTagNameNS

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
[email protected]

Unless otherwise noted, any price quotes contained within this  
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights  
Wesleyan Church!

And check out my blog, Adventures in Web Development, at 
http://jgeerdes.blogspot.com 
  !


On Mar 23, 2009, at 12:35 AM, BjP wrote:

>
> Hello,
>
> Im adapting a MRSS feed to display some of the latest videos added to
> the feed on my company sites;
>
> http://publish.vx.roo.com/g6publish/common/playlist/rssgeneratorportal.aspx?SiteId=cb519624-44a2-4bf7-808b-3514d34e96e4&Format=flash&v=3&thumbnailtypecode=wide_small&channel=Latest+Videos&rsstype=mrss
>
> The code Ive constructed has been a simple copy of one of the XML
> examples with some simple additions of jquery to render the result.
>
> However Ive found that in Firefox 2 and also Chrome I am unable to get
> the url attribute value of the media:thumbnail node  with the error
>
> item.getElementsByTagName("media:thumbnail")[0] has no properties
>
> appearing in Firebug.
>
> The code I am using for the feedloaded section;
>
> function feedLoaded(result) {
>  if (!result.error) {
>    // Get all items returned.
>    var items = result.xmlDocument.getElementsByTagName('item');
>    //clear out results div.
>    $(".video<%inf_pageid%>").empty();
>    $(".video<%inf_pageid%>").append('<h3>Latest Videos</h3>');
>    // Loop through our items
>    for (var i = 0; i < items.length; i++) {
>      var item = items[i];
>      // Get the title from the element.  firstChild is the text node
> containing
>      // the title, and nodeValue returns the value of it.
>      var title = item.getElementsByTagName("title")
> [0].firstChild.nodeValue;
>      var link = item.getElementsByTagName("link")
> [0].firstChild.nodeValue;
>      var descript= item.getElementsByTagName("description")
> [0].firstChild.nodeValue;
>      //var temp= item.getElementsByTagName("media:thumbnail")[0];
>      //alert(temp);
>      //var thumb = temp.attributes.getNamedItem("url").value;
>      var thumb = item.getElementsByTagName("media:thumbnail")
> [0].getAttribute("url");
>      //alert(ff2);
>      //create html string of complete listing
>      var html = '<div class="item"><div class="preview-image"><a
> title="' + title + '" href="'+ link + '"><img alt="' + title + '
> image" width="128" height="72" src="' + thumb + '"/></a></div><h4
> width="20"><a title="' + title + '" href="' + link + '">' + title +  
> '</
> a></h4><div class="text">' + descript + '</div></div>';
>      //clear and append the output of string to video div
>      $(".video<%inf_pageid%>").append(html);
>    }
>  }
> }
>
>
> Any ideas why this doesnt work in FF2 or Chrome?
>
> Thanks in advance,
> BjP
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to