1 Ext.define('FV.lib.FeedValidator', {
5 * @cfg {String} url The url to validate feeds on
10 * Validates a given feed's formating by fetching it and ensuring it is well formed
11 * @param {FV.model.Feed} feed The feed to validate
13 validate: function(feed, options) {
14 options = options || {};
16 Ext.applyIf(options, {
28 success: function(response) {
29 if (this.checkResponse(response, feed)) {
30 options.success.call(options.scope, feed);
34 options.failure.call(options.scope);
41 * Validates that a response contains a well-formed feed
42 * @param {Object} response The response object
44 checkResponse: function(response, feed) {
45 var dq = Ext.DomQuery,
46 url = feed.get('url'),
50 xml = response.responseXML;
51 channel = xml.getElementsByTagName('channel')[0];
54 title = dq.selectValue('title', channel, url);