2014-11-03 118 views
0

我想从这个XML获取内容。可以请建议我吗?使用jquery从xml获取Html内容

<?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

这是XML DOM中,或者是你从一个文件或Ajax调用读它? – nullability 2014-11-03 15:53:05

+0

你尝试过使用'find'吗?你有什么尝试?你有什么具体问题? – prodigitalson 2014-11-03 15:53:30

+0

我对这个使用XML URl – 2014-11-03 15:53:52

回答