Santhanam
Santhanam

Reputation: 348

How to traverse xml through jquery?

I am trying to traverse a rss feed in which a tag is present like below

<item>
<itunes:explicit>​no​</itunes:explicit>​
</item>

how do i get the value of itunes:explicit. i tried like below

_this = loadedData // xml data from the ajax request
$(_this).find('item').find('itunes:explicit').text()

It is not returning the text present in it.

Any way to access this ?

Upvotes: 2

Views: 442

Answers (3)

Tim Down
Tim Down

Reputation: 324507

You need to escape the colon in your selector so that jQuery doesn't interpret the colon as a CSS pseudo-class:

$(_this).find('itunes\\:explicit').text()

Upvotes: 2

Vivek
Vivek

Reputation: 11028

you can directly find the thing which you want..you don't need heirarchy for that..try with this code-

$(_this).find('itunes\\:explicit').text()

Upvotes: 0

robasta
robasta

Reputation: 4701

user parseXML, described here.

Upvotes: 2

Related Questions