Corey Corey - 4 months ago 15
jQuery Question

jQuery parsing RSS and namespaced element like <content:encoded>

I am using jQuery to parse an RSS feed. Within each

is a namespaced element like
I want to select. How do I select it in jQuery?

$(xml).find('item') works but $(xml).find('item content') does not.


Are you loading the xml via Ajax? Then, make sure that the server sets the content type as 'text/xml' and not 'text/html'.

Also make sure that the tag name of the element you want is indeed content and not something else (like content:encoded). In that case try:

.find('item content\\:encoded')?

Special characters like : need to be escaped in jQuery selectors.