I cannot select <title> tag in Atom XML using jQuery

妖精的绣舞 提交于 2020-01-03 18:14:54

问题


I get Atom data through Ajax using jQuery.

I write

$(xhr).find('entry id').eq(0).html();

is OK.

But

$(xhr).find('entry title').eq(0).html();

can not select anything.

title tag is actually exist.

Please help. Thank you!


回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/3957295/i-cannot-select-title-tag-in-atom-xml-using-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!