Namespaces in XML OK in Firefox, not IE or Safari?
I'm using jQuery 1.4.2 and attempting to parse an RSS XML file via AJAX. In Firefox, using "media\\:thumbnail" works fine to get an element with a namespace. This fails in IE 8, Safari for Windows and Safari for Mac and iPhone. Getting other elements without a namespace works fine in all browsers. I've searched the documentation and forums, and can't see that I am doing anything wrong. Here is a code snippet:
- // Define the RSS feeds to load for thumbnail images
var rssFeeds = new Array("photo/Favorites_2008/photos.rss",
"photo/Favorites_2009/photos.rss");
// Load images from MRSS feeds
function loadImages() {
// Loop through all RSS feed URLs
$.each(rssFeeds, function(key, value) {
// Make an AJAX call to get the RSS feed
$.ajax({url: value,
dataType: "xml",
async: false,
error: function(reqObject, textStatus, errorThrown) {
console.log("AJAX Error: " + textStatus + " - " + errorThrown);
},
success: function(xml, textStatus) {
// The RSS is Yahoo MRSS - get the thumbnails
// xmlns:media="http://search.yahoo.com/mrss"
console.log("AJAX Request Success");
// This find expression works in Firefox, but not IE or Safari
$(xml).find('media\\:thumbnail').each(function () {
// $(xml).find("title").each(function () {
// Add the thumbnail URL to the image array
favImages.push($(this).attr("url"));
// console.log("Added Image: " + $(this).attr("url"));
});
}
});
});
The RSS feed is here:
http://www.shawnstepper.com/photo/Favorites_2008/photos.rss
The tag in question:
- <media:thumbnail url="http://www.shawnstepper.com/photo/Favorites_2008/tn/IMG_1001.jpg" />
The docs say to use a double backslash, but it doesn't work in all browsers. Any help would be greatly appreciated!