• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Channel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: writeOtherCharset

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
@Test
public void writeOtherCharset() throws IOException, SAXException {
	Channel channel = new Channel("rss_2.0");
	channel.setTitle("title");
	channel.setLink("http://example.com");
	channel.setDescription("description");

	String encoding = "ISO-8859-1";
	channel.setEncoding(encoding);

	Item item1 = new Item();
	item1.setTitle("title1");

	MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
	converter.write(channel, null, outputMessage);

	assertEquals("Invalid content-type", new MediaType("application", "rss+xml", Charset.forName(encoding)),
			outputMessage.getHeaders().getContentType());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:20,代码来源:RssChannelHttpMessageConverterTests.java


示例17: parse

import com.sun.syndication.feed.rss.Channel; //导入依赖的package包/类
/**
 * Parses the data from the supplied InputStream, using the supplied baseURI
 * to resolve any relative URI references.
 *
 * @param in      The InputStream from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(InputStream in, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
    Preconditions.checkNotNull(baseURI);

    setBaseURI(baseURI);

    WireFeedInput input = new WireFeedInput();
    try {
        WireFeed feed = input.build(new InputSource(in));
        if(feed instanceof Channel) {
            parseFeed((Channel) feed);
        } else {
            throw new RDFParseException("data stream is not an RSS feed");
        }
    } catch (FeedException e) {
        throw new RDFParseException(e);
    }
}
 
开发者ID:apache,项目名称:marmotta,代码行数:32,代码来源:RSSParser.java


示例18: 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));
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:22,代码来源:ConverterForRSS090.java


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

}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:27,代码来源:ConverterForRSS091Userland.java


示例20: copyInto

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AuthorizationService类代码示例发布时间:2022-05-22
下一篇:
Java Overlay类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap