如何從CDATA和描述標籤中獲取圖像? 下面是XML代碼:從CDATA中獲取圖像並使用jquery描述標籤
<description>
<![CDATA[
<img src='http://www.autowereld.com/imagesDB/100/311151018460_.jpg' border='0' bordercolor='black' style='float:left; margin-right: 8px;margin-bottom: 8px;'>
]]>
Het is Subaru wat de klok slaat deze week. Na spyshots van de Subaru Legacy Touring, gelekte foto’s van de productierijpe WRX en de officiële bekendmaking van de Legacy Concept is het nu tijd voor de Crossover 7 Concept.
</description>
這是我得到:
var img = $(element).find("description").text();
img = img.replace("<![CDATA[", "").replace("]]>", "");
console.log(img);
$("#img").append('<img src="' + img + '">');
除非你是正確配對的XML標記不應該出現在文本中的CDATA。 – Quentin