I'm using YQL to fetch data using JSONP, and it returns a string of XML. I parse it using $.parseXML and put it inside the jQuery selector and try to select a node. However, it contains a namespace (for example, yweather:) and jQuery seems to not working as it should be.
From other SO answers they suggested that doing \\: will solve it. It does, but only when the data I received is XML (mine is with JSONP.)
$.ajax({
url: "http://query.yahooapis.com/v1/public/yql",
data: {
q: "select item from weather.forecast where location=48907",
format: "jsonp"
},
dataType: "jsonp"
}).success(function(data){
var xml = $.parseXML(data.results[0]);
console.log($("yweather\\:condition", xml));
});
It didn't match anything.
jsonformat and note the json format added to url generated in consoleget. Yes is very under used service, but can be really handy in app with no server support. Have even used it to scrape html using their xpath selectors