/** * ownCloud - News * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Bernhard Posselt * @copyright Bernhard Posselt 2014 */ app.service('OPMLParser', function () { 'use strict'; var parseOutline = function (outline) { var url = outline.attr('xmlUrl') || outline.attr('htmlUrl'); var name = outline.attr('title') || outline.attr('text') || url; // folder if (url === undefined) { return { type: 'folder', name: name, feeds: [] }; // feed } else { return { type: 'feed', name: name, url: url }; } }; // there is only one level, so feeds in a folder in a folder should be // attached to the root folder var recursivelyParse = function (level, root, firstLevel) { for (var i=0; i outline'); var root = { 'feeds': [], 'folders': [] }; return recursivelyParse(firstLevel, root, true); }; });