views:

65

answers:

1

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!

+6  A: 

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.

Aaron Digulla
+1 You're the only one that realizes the data is XML from an Ajax request and not HTML, as well as "jQuery is an HTML library, not an XML library"
BoltClock
What frustrating is that I know the problem now but I don't know the solution. My atom is a Google Picasa web albums' atom. It looks like this: http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_protocol.html#ListAlbums
dfbd
@dfdb: Read the article. It contains the explanation and the solution.
Aaron Digulla