使用jquery从xml获取Html内容

时间:2014-11-03 15:49:19

标签: jquery xml

我想从这个XML中获取内容。你能建议我吗?

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app"     xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:snx="http://www.ibm.com/xmlns/prod/sn"  xmlns:thr="http://purl.org/syndication/thread/1.0">
 <entry>
  <content type="html">&lt;p dir="ltr"&gt;
  &lt;strong&gt;Consumer demand for tiger parts poses the largest threat to tiger survival.over 1000 tigers have been killed to traffic their parts to meet consumer demandin Asia&lt;/strong&gt;.
&lt;/p&gt;</content>
</entry>
</feed>

javascript:

$.ajax({
type: "GET",
url: "https://greenhouse.lotus.com/forums/atom/topics?communityUuid=b73c26c9-175f-4a7b-938d-86da3118db95",
dataType: "xml",
success: function(xml) {

$(xml).find('feed').each(function(){

     $(xml).find('entry').each(function(){

     var summary= $(this).find('content').text();

}); });

1 个答案:

答案 0 :(得分:0)

我相信你需要.parseXML()方法。

文档在这里:http://api.jquery.com/jquery.parsexml/