Parsing mixed result from google feed api
Can someone give me example how to parse mixed feed result from google api (eg. XML + json). I'm trying to get enclosure element of the feed, but it seems that json resul开发者_如何学运维t doesn't return it! Thanks!
To get feeds in mixed mode you have to set results mode to MIXED_FORMAT. all entries should now include a xmlNode from which the enclosure element can be retrieved, and the url extracted:
var feed = new google.feeds.Feed(feedUrl);
feed.setResultFormat(google.feeds.Feed.MIXED_FORMAT);
feed.load( function(result) {
var entry = result.feed.entries[i];
var entryImageUrl = entry.xmlNode.getElementsByTagName("enclosure")[0].getAttribute("url");
});
精彩评论