protected WireFeed parseFeed(final Element eFeed, final Locale locale) throws FeedException { String baseURI = null; try { baseURI = findBaseURI(eFeed); } catch (final Exception e) { throw new FeedException("ERROR while finding base URI of feed", e); } final Feed feed = parseFeedMetadata(baseURI, eFeed, locale); feed.setStyleSheet(getStyleSheet(eFeed.getDocument())); final String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE); if (xmlBase != null) { feed.setXmlBase(xmlBase); } feed.setModules(parseFeedModules(eFeed, locale)); final List<Element> eList = eFeed.getChildren("entry", getAtomNamespace()); if (eList.size() > 0) { feed.setEntries(parseEntries(feed, baseURI, eList, locale)); } final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); if (foreignMarkup.size() > 0) { feed.setForeignMarkup(foreignMarkup); } return feed; }
protected WireFeed parseFeed(Element eFeed) { com.sun.syndication.feed.atom.Feed feed = new com.sun.syndication.feed.atom.Feed(getType()); Element e = eFeed.getChild("title", getAtomNamespace()); if (e != null) { feed.setTitleEx(parseContent(e)); } List<Element> eList = eFeed.getChildren("link", getAtomNamespace()); feed.setAlternateLinks(parseAlternateLinks(eList)); feed.setOtherLinks(parseOtherLinks(eList)); e = eFeed.getChild("author", getAtomNamespace()); if (e != null) { List<Person> authors = new ArrayList<Person>(); authors.add(parsePerson(e)); feed.setAuthors(authors); } eList = eFeed.getChildren("contributor", getAtomNamespace()); if (eList.size() > 0) { feed.setContributors(parsePersons(eList)); } e = eFeed.getChild("tagline", getAtomNamespace()); if (e != null) { feed.setTagline(parseContent(e)); } e = eFeed.getChild("id", getAtomNamespace()); if (e != null) { feed.setId(e.getText()); } e = eFeed.getChild("generator", getAtomNamespace()); if (e != null) { Generator gen = new Generator(); gen.setValue(e.getText()); String att = getAttributeValue(e, "url"); if (att != null) { gen.setUrl(att); } att = getAttributeValue(e, "version"); if (att != null) { gen.setVersion(att); } feed.setGenerator(gen); } e = eFeed.getChild("copyright", getAtomNamespace()); if (e != null) { feed.setCopyright(e.getText()); } e = eFeed.getChild("info", getAtomNamespace()); if (e != null) { feed.setInfo(parseContent(e)); } e = eFeed.getChild("modified", getAtomNamespace()); if (e != null) { feed.setModified(DateParser.parseDate(e.getText())); } feed.setModules(parseFeedModules(eFeed)); eList = eFeed.getChildren("entry", getAtomNamespace()); if (eList.size() > 0) { feed.setEntries(parseEntries(eList)); } List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace()); if (foreignMarkup.size() > 0) { feed.setForeignMarkup(foreignMarkup); } return feed; }