- This topic has 3 replies, 2 voices, and was last updated 10 years, 8 months ago by AdamRogan.
-
AuthorPosts
-
AdamRoganMemberOk im using the dynlist-demo example project to load a rss feed.
Im trying to parse a xml file.
Image , title, parses fine but nothing in the cdata section is being parsed.
this is my xml code.
<item>
<title>My title</title>
<pubDate>19/3/2014</pubDate>
<description>
<![CDATA[
<p style=”margin-left:10px;margin-right:10px;”><b>text content goes here.</b><br<br>
]]>
</description>
<image>
http://website/image/image.png
</item>and this is the script.
var selItem = $(event.srcElement).closest(‘li[data-listitem-index]’);
var itemId = $(selItem).attr(“data-listitem-index”);
var list_items = $(“:root”).data(“topsongs”);
var item = list_items[itemId];var title = item[“title”];
var desc = item[“description”];
var image = item[“image”];
var cont = item[“content”];$(“#m1-view_song-txt”).text(title);
$(“#m1-view_song-txt”).text(desc);
$(“#m1-view_song-img”).attr(“src” , image);function load_top25(active_page){
var list_items = new Array();
phoneui.showActivityDialog(“Loading the feed…”);
$.get(“http://mysite.com/trending.xml”, function(data) {
var $xml = $(data);
$xml.find(“item”).each(function() {
var $this = $(this),
item = {
title: $this.find(“title”).text(),
desc: $this.find(“description”).attr(“term”),
image: $this.find(“image”).text()
}
list_items.push(item);
});$(“:root”).data(“topsongs” , list_items);
render_list(active_page, list_items);
phoneui.hideActivityDialog();});
}
Im not sure how to parse the cdata in description.
any help would be great.
cheers………….
support-michaelKeymasterIs this stackoverflow topic helpful http://stackoverflow.com/questions/3658968/removing-cdata-from-xml-rss-feed-using-jquery
AdamRoganMemberThanks for that, got it working….
Now i have a another problem with the text being parsed is not wrapping.
any ideas on fixing that?
cheers
AdamRoganMemberAll fixed and done, cheers thanx.
you can close this thread………………………………………………… -
AuthorPosts