Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 894057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:19:13+00:00 2026-05-15T14:19:13+00:00

I am learning how to utilise external XML feeds within our Intranet, to better

  • 0

I am learning how to utilise external XML feeds within our Intranet, to better serve our staff and reduce their need to go outside the network for content.

I can render the basic information from the feed without a problem. Where I come unstuck is trying to display one of the video thumbnails to use as part of the my chosen layout.

Problem

I am trying to grab the value of URL property from the first media:thumbnail element for use in an img tag, but whatever I try I can’t seem to render the contents of it.

Eg;
<media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/default.jpg'... />

The piece of text I’d want to extract & use from the above example is http://i.ytimg.com/vi/CQP_AuT4zXQ/default.jpg

I suspect why I’m not able to parse the value of this element has something to do with the element name having a period (:) separator in it, and/or my developing knowledge of jQuery suspects I’m not calling or attempting to parse this element or part thereof correctly.

I’d also like to render the value of media:keywords as well, which would be solved by understanding the same issue.

Code used to render the XML

<script type="text/javascript">
/* learned from http://www.switchonthecode.com/tutorials/xml-parsing-with-jquery */
/* this can be used to parse any file in an XML format */
$(document).ready(function()
{
/*
perform an asynchronous ajax request using the relevant variables
Documentation: http://api.jquery.com/jQuery.ajax/
*/
  $.ajax({
    type: "GET",
    /* define url of xml file to parse */
    url: "/pr/rss_repository/youtube.xml",
    /* assign it a data type */
    dataType: "xml",
    /* state name of function to run if file is successfully parsed */
    success: parseXml
  });
});
function parseXml(xml)
/* this is where the xml file is parsed and converted into a HTML output */
{

  //for each item node in the xml file
  $(xml).find("item").each(function()
  {
  //print the following html, inserting the relevant data within the nodes of item
    //this is the heading
    $("#output").append("<h2><a href=\"" + $(this).find("link").text() + "\" target=\"_blank\"> " + $(this).find("title").text() + "</a></h2>\n");
//this is a new paragraph with the publication date
    $("#output").append("<p>" + $(this).find("pubDate").text() + "</p>\n");
//this is the description text of the item
$("#output").append("<p>" + $(this).find("description").text() + "</p>\n");
$("#output").append("<p><img src=\"" + $(this).find("media:thumbnail").text() + "\"></p>\n");
  });
 //end for each
//end function
}
</script>

Resultant HTML

<h2><a href="http://www.youtube.com/watch?v=CQP_AuT4zXQ&amp;feature=youtube_gdata" target="_blank"> IFA World Forestry Day 2010 forum - Bob Pearce, FIFWA (Part 1)</a></h2>
<p>Thu, 01 Apr 2010 06:44:19 +0000</p>
<p>Bob Pearce, Executive Director - Forest Industries Federation of Western Australia delivers a presentation on the impact of timber harvesting in healthy forests at the Institute of Foresters of Australia 2010 World Forestry Day forum.</p>
<p><img src=""></p>
...

Sample of XML from Youtube being parsed

The file is grabbed and brought into our servers here, to save the file being downloaded each time it is called. We pull it into the network using VBScript which dumps the contents returned from the URL queried.

Example of data, from http://gdata.youtube.com/feeds/api/videos?alt=rss&author=fpcwa:

<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:gml='http://www.opengis.net/gml' xmlns:yt='http://gdata.youtube.com/schemas/2007' xmlns:georss='http://www.georss.org/georss' version='2.0'>
  <channel>
    ... standard channel description
    <item>
      <guid isPermaLink='false'>tag:youtube.com,2008:video:CQP_AuT4zXQ</guid>
      <pubDate>Thu, 01 Apr 2010 06:44:19 +0000</pubDate>
      <atom:updated>2010-04-29T00:03:31.000Z</atom:updated>
      <category domain='http://schemas.google.com/g/2005#kind'>http://gdata.youtube.com/schemas/2007#video</category>
      <category domain='http://gdata.youtube.com/schemas/2007/categories.cat'>News</category>
      <category domain='http://gdata.youtube.com/schemas/2007/keywords.cat'>ifa</category>
      ... remaining categories
      <title>IFA World Forestry Day 2010 forum - Bob Pearce, FIFWA (Part 1)</title>
      <link>http://www.youtube.com/watch?v=CQP_AuT4zXQ&feature=youtube_gdata</link>
      <author>fpcwa</author>
      <yt:accessControl action='comment' permission='allowed'/>
      ...
      <gd:comments>
        <gd:feedLink href='http://gdata.youtube.com/feeds/api/videos/CQP_AuT4zXQ/comments?client=ytapi-google-jsdemo' countHint='0'/>
      </gd:comments>
      <media:group>
        <media:category label='News & Politics' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>News</media:category>
        <media:content url='http://www.youtube.com/v/CQP_AuT4zXQ?f=videos&c=ytapi-google-jsdemo&app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='587' yt:format='5'/>
        <media:content url='rtsp://v1.cache6.c.youtube.com/CjcLENy73wIaLgl0zfjkAv8DCRMYDSANFEITeXRhcGktZ29vZ2xlLWpzZGVtb0gGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='587' yt:format='1'/>
        <media:content url='rtsp://v2.cache3.c.youtube.com/CjcLENy73wIaLgl0zfjkAv8DCRMYESARFEITeXRhcGktZ29vZ2xlLWpzZGVtb0gGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='587' yt:format='6'/>
        <media:credit role='uploader' scheme='urn:youtube'>fpcwa</media:credit>
        <media:description type='plain'>Bob Pearce, Executive Director - Forest Industries Federation of Western Australia delivers a presentation on the impact of timber harvesting in healthy forests at the Institute of Foresters of Australia 2010 World Forestry Day forum.</media:description>
        <media:keywords>ifa, institute of foresters, australia, forestry, world forestry day, 2010, forum, healthy forests, forest, forests, bob pearce, fifwa</media:keywords>
        <media:player url='http://www.youtube.com/watch?v=CQP_AuT4zXQ&feature=youtube_gdata'/>
        <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/default.jpg' height='90' width='120' time='00:04:53.500'/>
        <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/2.jpg' height='90' width='120' time='00:04:53.500'/>
        <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/1.jpg' height='90' width='120' time='00:02:26.750'/>
        <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/3.jpg' height='90' width='120' time='00:07:20.250'/>
        <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/hqdefault.jpg' height='360' width='480'/>
        <media:title type='plain'>IFA World Forestry Day 2010 forum - Bob Pearce, FIFWA (Part 1)</media:title>
        <yt:aspectRatio>widescreen</yt:aspectRatio>
        <yt:duration seconds='587'/>
        <yt:uploaded>2010-04-01T06:44:19.000Z</yt:uploaded>
        <yt:videoid>CQP_AuT4zXQ</yt:videoid>
      </media:group>
      <yt:statistics favoriteCount='0' viewCount='10'/>
    </item>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:19:14+00:00Added an answer on May 15, 2026 at 2:19 pm

    This is a bug in jQuery, where it does not support handling XML namespaces. You can one of the following two approaches:

    .find("[nodeName=media:thumbnail]")
    .find("media\\:thumbnail]")
    

    Most people recommend the first one since the second one does not work under certain WebKit versions.

    If you want more details or other alternatives, do a search for “jquery find namespace” on the web.

    Update: To get the value of the ulr attribute on the media:thumbnail node, use the following:

    .attr("url")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For learning and demonstrating, I need a macro which prints its parameter and evaluates
I'm just learning how to utilise ajax/json with jquery and I've hit a brick
I`m learning programming languages. And I decide that I need to lear a new
Learning XML Schema, I want to be able to have collections of elements inside
Learning asp.net mvc and whenever I worked we had to localize our application. Looked
Learning WPF nowadays. Found something new today with .Net dependency properties. What they bring
Learning a little about T-SQL, and thought an interesting exercise would be to generate
Learning from my last question , most member names seem to get included in
Will learning C++ help me build native applications with good speed? Will it help
While learning different languages, I've often seen objects allocated on the fly, most often

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.