This may not apply to all cases, but when extracting from xml I had this problem that I solved with this.
function grab_xml(what){ var return_xml =null; $.ajax({ type: "GET", url: what, success:function(xml){return_xml =xml;}, async: false }); return(return_xml); }
then we get xml:
var sector_xml=grab_xml("p/sector.xml"); var tt=$(sector_xml).find("pt");
Then then I made this function to extract the xml string when I need to read from an XML file containing html tags.
function extract_xml_line(who){ var tmp = document.createElement("div"); tmp.appendChild(who[0]); var tmp=$(tmp.innerHTML).html(); return(tmp); }
and now conclude:
var str_of_html= extract_xml_line(tt.find("intro"));
Miguel May 08 '13 at 15:39 2013-05-08 15:39
source share