Ok So I looked at this: Using jQuery to extract CDATA in XML for use as HTML content
But it didn't help with what I'm doing. I'm getting an rss/xml feed from a url. I'm having an issue with the CDATA in the title and description tag. Here's the feed item:
<item><title><![CDATA[Impact South Africa (Girls)]]></title><link>http://www.thriveafricastore.com/products.php?product=Impact-South-Africa-%28Girls%29</link><pubDate>Mon, 29 Mar 2010 19:02:26 +0000</pubDate><guid isPermaLink="false">http://www.thriveafricastore.com/products.php?product=Impact-South-Africa-%28Girls%29</guid><description><![CDATA[<div style='float: right; padding: 10px;'><a href="http://www.thriveafricastore.com/products.php?product=Impact-South-Africa-%28Girls%29"><img src="http://www.thriveafricastore.com/product_images/t/266/girls__27047_thumb.jpg" alt="" /></a></div><p><strong>You can help us impact South Africa. Do something!<br /></strong></p><p>Your basic jersey tee, only better! Made just for women, it contours to your shape and always looks flattering and chic even with a simple pair of jeans. This is one t-shirt you'll want to stock pile. Pre-shrunk 1..<p><strong>Price: <span class="SalePrice">$10.00</span></strong> </p>]]></description><content:encoded><![CDATA[<div style='float: right; padding: 10px;'><a href="http://www.thriveafricastore.com/products.php?product=Impact-South-Africa-%28Girls%29"><img src="http://www.thriveafricastore.com/product_images/t/266/girls__27047_thumb.jpg" alt="" /></a></div><p><strong>You can help us impact South Africa. Do something!<br /></strong></p><p>Your basic jersey tee, only better! Made just for women, it contours to your shape and always looks flattering and chic even with a simple pair of jeans. This is one t-shirt you'll want to stock pile. Pre-shrunk 1..<p><strong>Price: <span class="SalePrice">$10.00</span></strong> </p>]]></content:encoded></item>
And here's the jQuery I have so far:
$.get('http://www.thriveafricastore.com/rss.php?type=xml', {}, function(d) { $('body').append('New Thrive Store Items'); $('body').append('<div>'); $('item', d).each(function() { var $item = $(this); var title = $item.find('title'); var description = $item.find('description').text(); var link = $item.find('link'); var html = '<h3><a href="'+ link +'">'+ title +'</a></h3>'; $('div').append($(html)); }); }, 'xml');
Any ideas on my next stop to removing the CDATA tag so I can just pull the content out?
Thanks so much!