Package com.sun.syndication.feed.rss

Examples of com.sun.syndication.feed.rss.Channel


        model.put("feedTitle", "my branch");
        model.put("feedDescription", "my description");
        model.put("urlSuffix", "/branches/42");

        Channel channel = new Channel();

        postListRssViewer.buildFeedMetadata(model, channel, getMockRequest());

        assertEquals(channel.getTitle(), "my branch");
        assertEquals(channel.getDescription(), "my description");
        assertEquals(channel.getLink(), "http://localhost:8080/jcommune/branches/42");
    }
View Full Code Here


     * @return the parsed Channel bean.
     */
    protected WireFeed parseChannel(Element rssRoot) {
        Element eChannel = rssRoot.getChild("channel", getRSSNamespace());

        Channel channel = new Channel(getType());

        Element e = eChannel.getChild("title",getRSSNamespace());
        if (e!=null) {
            channel.setTitle(e.getText());
        }
        e = eChannel.getChild("link",getRSSNamespace());
        if (e!=null) {
            channel.setLink(e.getText());
        }
        e = eChannel.getChild("description",getRSSNamespace());
        if (e!=null) {
            channel.setDescription(e.getText());
        }

        channel.setImage(parseImage(rssRoot));

        channel.setTextInput(parseTextInput(rssRoot));

        // Unfortunately Microsoft's SSE extension has a special case of
        // effectively putting the sharing channel module inside the RSS tag
        // and not inside the channel itself. So we also need to look for
        // channel modules from the root RSS element.
        List allFeedModules = new ArrayList();
        List rootModules = parseFeedModules(rssRoot);
        List channelModules = parseFeedModules(eChannel);
        if (rootModules != null) {
            allFeedModules.addAll(rootModules);
        }
        if (channelModules != null) {
            allFeedModules.addAll(channelModules);
        }
        channel.setModules(allFeedModules);
        channel.setItems(parseItems(rssRoot));

        List foreignMarkup =
            extractForeignMarkup(eChannel, channel, getRSSNamespace());
        if (foreignMarkup.size() > 0) {
            channel.setForeignMarkup(foreignMarkup);
        }         
        return channel;
    }
View Full Code Here

     *
     * @param rssRoot the root element of the RSS document to parse.
     * @return the parsed Channel bean.
     */
    protected WireFeed parseChannel(Element rssRoot)  {
        Channel channel = (Channel) super.parseChannel(rssRoot);

        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());

        Element e = eChannel.getChild("language",getRSSNamespace());
        if (e!=null) {
            channel.setLanguage(e.getText());
        }
        e = eChannel.getChild("rating",getRSSNamespace());
        if (e!=null) {
            channel.setRating(e.getText());
        }
        e = eChannel.getChild("copyright",getRSSNamespace());
        if (e!=null) {
            channel.setCopyright(e.getText());
        }
        e = eChannel.getChild("pubDate",getRSSNamespace());
        if (e!=null) {
            channel.setPubDate(DateParser.parseDate(e.getText()));
        }
        e = eChannel.getChild("lastBuildDate",getRSSNamespace());
        if (e!=null) {
            channel.setLastBuildDate(DateParser.parseDate(e.getText()));
        }
        e = eChannel.getChild("docs",getRSSNamespace());
        if (e!=null) {
            channel.setDocs(e.getText());
        }
        e = eChannel.getChild("docs",getRSSNamespace());
        if (e!=null) {
            channel.setDocs(e.getText());
        }
        e = eChannel.getChild("managingEditor",getRSSNamespace());
        if (e!=null) {
            channel.setManagingEditor(e.getText());
        }
        e = eChannel.getChild("webMaster",getRSSNamespace());
        if (e!=null) {
            channel.setWebMaster(e.getText());
        }
        e = eChannel.getChild("skipHours");
        if (e!=null) {
            List skipHours = new ArrayList();
            List eHours = e.getChildren("hour",getRSSNamespace());
            for (int i=0;i<eHours.size();i++) {
                Element eHour = (Element) eHours.get(i);
                skipHours.add(new Integer(eHour.getText().trim()));
            }
            channel.setSkipHours(skipHours);
        }

        e = eChannel.getChild("skipDays");
        if (e!=null) {
            List skipDays = new ArrayList();
            List eDays = e.getChildren("day",getRSSNamespace());
            for (int i=0;i<eDays.size();i++) {
                Element eDay = (Element) eDays.get(i);
                skipDays.add(eDay.getText().trim());
            }
            channel.setSkipDays(skipDays);
        }
        return channel;
    }
View Full Code Here

    protected String getRSSVersion() {
            return "0.92";
    }

    protected WireFeed parseChannel(Element rssRoot)  {
        Channel channel = (Channel) super.parseChannel(rssRoot);

        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
        Element eCloud = eChannel.getChild("cloud",getRSSNamespace());
        if (eCloud!=null) {
            Cloud cloud = new Cloud();
            String att = eCloud.getAttributeValue("domain");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
            if (att!=null) {
                cloud.setDomain(att);
            }
            att = eCloud.getAttributeValue("port");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
            if (att!=null) {
                cloud.setPort(Integer.parseInt(att.trim()));
            }
            att = eCloud.getAttributeValue("path");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
            if (att!=null) {
                cloud.setPath(att);
            }
            att = eCloud.getAttributeValue("registerProcedure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
            if (att!=null) {
                cloud.setRegisterProcedure(att);
            }
            att = eCloud.getAttributeValue("protocol");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
            if (att!=null) {
                cloud.setProtocol(att);
            }
            channel.setCloud(cloud);
        }
        return channel;
    }
View Full Code Here

    protected ConverterForRSS094(String type) {
        super(type);
    }

    public void copyInto(WireFeed feed,SyndFeed syndFeed) {
        Channel channel = (Channel) feed;
        super.copyInto(channel,syndFeed);
        List cats = channel.getCategories();    //c
        if (cats.size()>0) {
            Set s = new HashSet();                // using a set to remove duplicates
            s.addAll(createSyndCategories(cats)); // feed native categories (as syndcat)
            s.addAll(syndFeed.getCategories());   // DC subjects (as syndcat)
            syndFeed.setCategories(new ArrayList(s));
View Full Code Here

        return syndEntry;
    }


    protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
        Channel channel = (Channel) super.createRealFeed(type,syndFeed);
        List cats = syndFeed.getCategories();    //c
        if (cats.size()>0) {
            channel.setCategories(createRSSCategories(cats));
        }
        return channel;
    }
View Full Code Here

    return "Read " + channel.getTitle();
  }
 
  @RequestMapping(value="/rss", method=RequestMethod.GET)
  public @ResponseBody Channel writeChannel() {
    Channel channel = new Channel();
    channel.setFeedType("rss_2.0");
    channel.setTitle("My RSS feed");
    channel.setDescription("Description");
    channel.setLink("http://localhost:8080/mvc-showcase/rss");
    return channel;
  }
View Full Code Here

    protected ConverterForRSS091Userland(String type) {
        super(type);
    }

    public void copyInto(WireFeed feed,SyndFeed syndFeed) {
        Channel channel = (Channel) feed;
        super.copyInto(channel,syndFeed);
        syndFeed.setLanguage(channel.getLanguage());        //c
        syndFeed.setCopyright(channel.getCopyright());      //c
        Date pubDate = channel.getPubDate();
        if (pubDate!=null) {
            syndFeed.setPublishedDate(pubDate)//c
        } else if (channel.getLastBuildDate() != null) {
            syndFeed.setPublishedDate(channel.getLastBuildDate())//c
        }
       

        String author = channel.getManagingEditor();
        if (author!=null) {   
            List creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
            if (!creators.contains(author)) {
                Set s = new HashSet(); // using a set to remove duplicates
                s.addAll(creators);    // DC creators
View Full Code Here

        }
        return syndEntry;
    }

    protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
        Channel channel = (Channel) super.createRealFeed(type,syndFeed);
        channel.setLanguage(syndFeed.getLanguage());        //c
        channel.setCopyright(syndFeed.getCopyright());      //c
        channel.setPubDate(syndFeed.getPublishedDate());    //c       
        if (syndFeed.getAuthors()!=null && syndFeed.getAuthors().size() > 0) {
            SyndPerson author = (SyndPerson)syndFeed.getAuthors().get(0);
            channel.setManagingEditor(author.getName())
        }       
        return channel;
    }
View Full Code Here

    protected ConverterForRSS10(String type) {
        super(type);
    }

    public void copyInto(WireFeed feed,SyndFeed syndFeed) {
        Channel channel = (Channel) feed;
        super.copyInto(channel,syndFeed);
        if (channel.getUri() != null) {
          syndFeed.setUri(channel.getUri());
        } else {
          // if URI is not set use the value for link
          syndFeed.setUri(channel.getLink());
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.rss.Channel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.