当前位置: 首页>>代码示例>>Java>>正文


Java Channel.setSkipDays方法代码示例

本文整理汇总了Java中com.sun.syndication.feed.rss.Channel.setSkipDays方法的典型用法代码示例。如果您正苦于以下问题:Java Channel.setSkipDays方法的具体用法?Java Channel.setSkipDays怎么用?Java Channel.setSkipDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.syndication.feed.rss.Channel的用法示例。


在下文中一共展示了Channel.setSkipDays方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
/**
 * Parses the root element of an RSS document into a Channel bean.
 * <p/>
 * It first invokes super.parseChannel and then parses and injects the following
 * properties if present: language, pubDate, rating and copyright.
 * <p/>
 *
 * @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.parseRFC822(e.getText()));
    }
    e = eChannel.getChild("lastBuildDate",getRSSNamespace());
    if (e!=null) {
        channel.setLastBuildDate(DateParser.parseRFC822(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;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:75,代码来源:RSS091UserlandParser.java

示例2: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入方法依赖的package包/类
/**
 * Parses the root element of an RSS document into a Channel bean.
 * <p/>
 * It first invokes super.parseChannel and then parses and injects the following
 * properties if present: language, pubDate, rating and copyright.
 * <p/>
 *
 * @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;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:75,代码来源:RSS091UserlandParser.java


注:本文中的com.sun.syndication.feed.rss.Channel.setSkipDays方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。