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


Java Channel类代码示例

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


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

示例1: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
protected WireFeed parseChannel(Element rssRoot)  {
    Channel channel = (Channel) super.parseChannel(rssRoot);
    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());

    List eCats = eChannel.getChildren("category",getRSSNamespace());
    channel.setCategories(parseCategories(eCats));

    Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
    if (eTtl!=null) {
        Integer ttlValue = new Integer(eTtl.getText());
        if (ttlValue != null) {
            channel.setTtl(ttlValue.intValue());
        }
    }

    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:RSS094Parser.java

示例2: copyInto

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));

    syndFeed.setEncoding(feed.getEncoding());
    Channel channel = (Channel) feed;
    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    Image image = channel.getImage();
    if (image!=null) {
        syndFeed.setImage(createSyndImage(image));
    }

    List items = channel.getItems();
    if (items!=null) {
        syndFeed.setEntries(createSyndEntries(items));
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:ConverterForRSS090.java

示例3: createRealFeed

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
protected WireFeed createRealFeed(String type,SyndFeed syndFeed) {
    Channel channel = new Channel(type);
    channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));

    channel.setEncoding(syndFeed.getEncoding());

    channel.setTitle(syndFeed.getTitle());
    channel.setLink(syndFeed.getLink());
    channel.setDescription(syndFeed.getDescription());
    SyndImage sImage = syndFeed.getImage();
    if (sImage!=null) {
        channel.setImage(createRSSImage(sImage));
    }

    List sEntries = syndFeed.getEntries();
    if (sEntries!=null) {
        channel.setItems(createRSSItems(sEntries));
    }
    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:ConverterForRSS090.java

示例4: copyInto

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
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
    }

    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
            s.add(author);         // feed native author
            creators.clear();
            creators.addAll(s);
        }
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:ConverterForRSS091Userland.java

示例5: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
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));
        }
        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;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:RSS092Parser.java

示例6: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
protected WireFeed parseChannel(Element rssRoot) {
    Channel channel = (Channel) super.parseChannel(rssRoot);

    Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
    String uri = eChannel.getAttributeValue("about", getRDFNamespace());
    if (uri != null) {
        channel.setUri(uri);
    }

    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:RSS10Parser.java

示例7: populateChannel

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
protected void populateChannel(Channel channel,Element eChannel) {
    super.populateChannel(channel,eChannel);
    if (channel.getUri() != null) {
        eChannel.setAttribute("about", channel.getUri(), getRDFNamespace());
    }
    List items = channel.getItems();
    if (items.size()>0) {
        Element eItems = new Element("items",getFeedNamespace());
        Element eSeq = new Element("Seq",getRDFNamespace());
        for (int i=0;i<items.size();i++) {
            Item item = (Item) items.get(i);
            Element eLi = new Element("li",getRDFNamespace());
            String link = item.getLink();
            if (link!=null) {
                eLi.setAttribute("resource",link);
            }
            eSeq.addContent(eLi);
        }
        eItems.addContent(eSeq);
        eChannel.addContent(eItems);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:RSS10Generator.java

示例8: populateChannel

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
protected void populateChannel(Channel channel,Element eChannel) {
    super.populateChannel(channel,eChannel);

    String generator = channel.getGenerator();
    if (generator != null) {
        eChannel.addContent(generateSimpleElement("generator", generator));
    }

    int ttl = channel.getTtl();
    if (ttl>-1) {
        eChannel.addContent(generateSimpleElement("ttl", String.valueOf(ttl)));
    }

    List categories = channel.getCategories();
    for(int i = 0; i < categories.size(); i++) {
        eChannel.addContent(generateCategoryElement((Category)categories.get(i)));
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:RSS20Generator.java

示例9: copyInto

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
    if (((List)feed.getForeignMarkup()).size() > 0) {
        syndFeed.setForeignMarkup(feed.getForeignMarkup());
    }
    syndFeed.setEncoding(feed.getEncoding());
    Channel channel = (Channel) feed;
    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    Image image = channel.getImage();
    if (image!=null) {
        syndFeed.setImage(createSyndImage(image));
    }

    List items = channel.getItems();
    if (items!=null) {
        syndFeed.setEntries(createSyndEntries(items, syndFeed.isPreservingWireFeed()));
    }
}
 
开发者ID:4thline,项目名称:feeds,代码行数:22,代码来源:ConverterForRSS090.java

示例10: createRealFeed

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
@Override
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;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:17,代码来源:ConverterForRSS091Userland.java

示例11: parseChannel

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
protected WireFeed parseChannel(Element rssRoot)  {
    Channel channel = (Channel) super.parseChannel(rssRoot);
    Element eChannel = rssRoot.getChild("channel",getRSSNamespace());

    List eCats = eChannel.getChildren("category",getRSSNamespace());
    channel.setCategories(parseCategories(eCats));

    Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
    if (eTtl!=null && eTtl.getText() != null ) {
        Integer ttlValue = null;        
        try{
             ttlValue = new Integer(eTtl.getText());
        } catch(NumberFormatException nfe ){ 
            ; //let it go by
        }
        if (ttlValue != null) {
            channel.setTtl(ttlValue.intValue());
        }
    }

    return channel;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:23,代码来源:RSS094Parser.java

示例12: populateChannel

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
protected void populateChannel(Channel channel,Element eChannel) {
    super.populateChannel(channel,eChannel);
    if (channel.getUri() != null) {
        eChannel.setAttribute("about", channel.getUri(), getRDFNamespace());
    }
    List items = channel.getItems();
    if (items.size()>0) {
        Element eItems = new Element("items",getFeedNamespace());
        Element eSeq = new Element("Seq",getRDFNamespace());
        for (int i=0;i<items.size();i++) {
            Item item = (Item) items.get(i);
            Element eLi = new Element("li",getRDFNamespace());
            String uri = item.getUri();
            if (uri!=null) {
                eLi.setAttribute("resource",uri,getRDFNamespace());
            }
            eSeq.addContent(eLi);
        }
        eItems.addContent(eSeq);
        eChannel.addContent(eItems);
    }
}
 
开发者ID:4thline,项目名称:feeds,代码行数:23,代码来源:RSS10Generator.java

示例13: createViaStruct

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
public void createViaStruct(cfTag tag, cfStructData cffeeddata ) throws cfmRunTimeException {
	String type = cffeeddata.getData("version").getString();
	if ( type.equals("rss_2.0") ){
		activeRSS	= new Channel( type );
	}else if ( type.equals("atom_1.0") ){
		activeATOM = new Feed( type );
	}else{
		throw tag.newRunTimeException( "Invalid feed format; only supporting rss_2.0 and atom_1.0" );
	}
	
	
	if ( activeRSS != null ){
		renderMetaDataToRss( tag, cffeeddata );
		renderEntriesToRss( tag, cffeeddata );
	}else if ( activeATOM != null ){
		renderMetaDataToAtom( tag, cffeeddata );
		renderEntriesToAtom( tag, cffeeddata );
	}
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:20,代码来源:CreateFeed.java

示例14: createViaQuery

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
public void createViaQuery(cfTag tag, cfQueryResultData query, cfStructData properties, cfStructData columnMap ) throws cfmRunTimeException {
	String type = properties.getData("version").getString();
	if ( type.equals("rss_2.0") ){
		activeRSS	= new Channel( type );
	}else if ( type.equals("atom_1.0") ){
		activeATOM = new Feed( type );
	}else{
		throw tag.newRunTimeException( "Invalid feed format; only supporting rss_2.0 and atom_1.0" );
	}

	
	if ( activeRSS != null ){
		renderMetaDataToRss( tag, properties );
		renderEntriesToRss( tag, convertQueryToStructRss(tag, query, columnMap) );
	}else if ( activeATOM != null ){
		renderMetaDataToAtom( tag, properties );
		renderEntriesToAtom( tag, convertQueryToStructAtom(tag, query, columnMap) );
	}
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:20,代码来源:CreateFeed.java

示例15: read

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
@Test
public void read() throws IOException {
	InputStream is = getClass().getResourceAsStream("rss.xml");
	MockHttpInputMessage inputMessage = new MockHttpInputMessage(is);
	inputMessage.getHeaders().setContentType(new MediaType("application", "rss+xml", utf8));
	Channel result = converter.read(Channel.class, inputMessage);
	assertEquals("title", result.getTitle());
	assertEquals("http://example.com", result.getLink());
	assertEquals("description", result.getDescription());

	List<?> items = result.getItems();
	assertEquals(2, items.size());

	Item item1 = (Item) items.get(0);
	assertEquals("title1", item1.getTitle());

	Item item2 = (Item) items.get(1);
	assertEquals("title2", item2.getTitle());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:20,代码来源:RssChannelHttpMessageConverterTests.java


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