我正在尝试读取xml/atom文件,代码是:
$.ajax({
type: 'GET',
url: options.url,
data: options.data,
dataType: 'xml',
async:options.async,
success: function(xml) {
var feed = new JFeed(xml);
if(jQuery.isFunction(options.success)) options.success(feed);
}
});atom文件有一个类似如下的字段:
<entry>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">Docentes y alumnos desa...</div>
</content>
</entry>读取content标签的代码是:
jQuery(this).find('content').eq(0).text();这是->的入口部分。
问题是,当jQuery执行此行时,返回"Docentes y alumnos desa...“。jQuery有一种返回方式->
"<div xmlns="http://www.w3.org/1999/xhtml">Docentes y alumnos desa...</div>"谢谢!!为英国人感到抱歉!!
发布于 2010-01-29 17:15:22
jQuery(this).find('content').eq(0).html();从
http://api.jquery.com/html/
:]
编辑:对不起,应该更好地阅读api。
在这里,他们解决了类似的问题:http://refactormycode.com/codes/341-jquery-all-descendent-text-nodes-within-a-node
https://stackoverflow.com/questions/2160893
复制相似问题