Parsing XML namespace elements with jQuery

Let’s assume that we have loaded through AJAX an XML file and we wanted to parse a XML element “artist” with the namespace “palcoprincipal” to get the Artist name:


<palcoprincipal:artist>Cool Artist </palcoprincipal:artist>

You may be tempted to parse it like this:

$(xml_string).find(‘palcoprincipal:artist’).text()

but it won’t work.
The correct way (and multi-browser-way) is like this:

$(xml_string).find(‘[nodeName=palcoprincipal:artist]’).text()