我无法选择< title>使用jQuery在Atom XML中标记 [英] I cannot select <title> tag in Atom XML using jQuery
问题描述
我使用jQuery通过Ajax获取Atom数据。
I get Atom data through Ajax using jQuery.
我写
$(xhr).find('entry id').eq(0).html();
没问题。
但是
$(xhr).find('entry title').eq(0).html();
无法选择任何内容。
title标签实际上存在。
title tag is actually exist.
请帮忙。谢谢!
推荐答案
这是因为没有 title
元素Atom XML。实际名称是 atom:title
如果XML命名空间 http://www.w3.org/2005/Atom
被映射到名称空间前缀 atom
。
That is because there is no title
element in the Atom XML. The actual name is atom:title
if the XML namespace http://www.w3.org/2005/Atom
was mapped to the namespace prefix atom
.
你的问题是jQuery是一个HTML库,而不是一个XML库。因此,在处理真实的XML数据时它有一些缺点。
Your problem is that jQuery is a HTML library, not an XML library. Therefore, it has some shortcomings when it comes to handling real XML data.
你需要的是一个插件。这个 IBM developerworks文章应该会让你知道我在说什么关于以及如何解决它。
What you need is a plugin. This IBM developerworks article should give you some idea what I'm talking about and how to solve it.
这篇关于我无法选择< title>使用jQuery在Atom XML中标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!