How can I handle XML namespaces in CSS Selectors or in jQuery?

前端 未结 2 1656
天涯浪人
天涯浪人 2021-01-13 04:06

I use jQuery to parse an RSS feed. I can successfully get the RSS feed using AJAX:

$.get(\"podcast.xml\", function (data) {
    xml = $(data);
}, \"xml\");
<         


        
2条回答
  •  灰色年华
    2021-01-13 04:26

    I want to add something wired I just explored: If I try the above code on my rekonq browser (which uses webkit), I cannot find the tag by searching for xml.find("channel > itunes\\:image").

    I have to omit the term itunes: and have to type xml.find("channel > image"). So we have:

    xml.find("channel > itunes\\:image") /* Firefox */
    
    xml.find("channel > image") /* Rekonq (maybe also Safari and Chrome?!) */
    

提交回复
热议问题