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


Java Item.setContent方法代码示例

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


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

示例1: buildFeedItems

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List<Item> buildFeedItems(Map<String, Object> model,
		HttpServletRequest req, HttpServletResponse resp) throws Exception {
	
	// get data model which is passed by the Spring container
	List<HrmsNews> news = (List<HrmsNews>) model.get("allNews");
       List<Item> items = new ArrayList<Item>(news.size());
 	
	for(HrmsNews topic : news ){
	
		Item item = new Item();
		
		Content content = new Content();
		content.setValue(topic.getSummary());
		item.setContent(content);
		
		item.setTitle(topic.getDescription());
		item.setLink(topic.getLink());
		item.setPubDate(new Date());
		
		items.add(item);
	}
	
	return items;
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:27,代码来源:HrmsRssViewBuilder.java

示例2: createRSSItem

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected Item createRSSItem(final SyndEntry sEntry) {

    final Item item = super.createRSSItem(sEntry);

    final SyndContent desc = sEntry.getDescription();
    if (desc != null) {
        item.setDescription(createItemDescription(desc));
    }

    final List<SyndContent> contents = sEntry.getContents();
    if (Lists.isNotEmpty(contents)) {
        item.setContent(createItemContent(contents.get(0)));
    }

    final String uri = sEntry.getUri();
    if (uri != null) {
        item.setUri(uri);
    }

    return item;
}
 
开发者ID:rometools,项目名称:rome,代码行数:23,代码来源:ConverterForRSS10.java

示例3: createRSSItem

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected Item createRSSItem(final SyndEntry sEntry) {

    final Item item = super.createRSSItem(sEntry);

    item.setComments(sEntry.getComments());

    final SyndContent sContent = sEntry.getDescription();

    if (sContent != null) {
        item.setDescription(createItemDescription(sContent));
    }

    final List<SyndContent> contents = sEntry.getContents();

    if (Lists.isNotEmpty(contents)) {
        final SyndContent syndContent = contents.get(0);
        final Content cont = new Content();
        cont.setValue(syndContent.getValue());
        cont.setType(syndContent.getType());
        item.setContent(cont);
    }

    return item;
}
 
开发者ID:rometools,项目名称:rome,代码行数:26,代码来源:ConverterForRSS091Userland.java

示例4: parseItem

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It first invokes super.parseItem and then parses and injects the description property if
 * present.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document in case it's needed for context.
 * @param eItem the item element to parse.
 * @return the parsed RSSItem bean.
 */
@Override
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) {

    final Item item = super.parseItem(rssRoot, eItem, locale);

    final Element description = eItem.getChild("description", getRSSNamespace());
    if (description != null) {
        item.setDescription(parseItemDescription(rssRoot, description));
    }

    final Element encoded = eItem.getChild("encoded", getContentNamespace());
    if (encoded != null) {
        final Content content = new Content();
        content.setType(Content.HTML);
        content.setValue(encoded.getText());
        item.setContent(content);
    }

    final String about = eItem.getAttributeValue("about", getRDFNamespace());
    if (about != null) {
        item.setUri(about);
    }

    return item;
}
 
开发者ID:rometools,项目名称:rome,代码行数:37,代码来源:RSS10Parser.java

示例5: parseItem

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It first invokes super.parseItem and then parses and injects the description property if
 * present.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document in case it's needed for context.
 * @param eItem the item element to parse.
 * @return the parsed RSSItem bean.
 */
@Override
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) {

    final Item item = super.parseItem(rssRoot, eItem, locale);

    final Element description = eItem.getChild("description", getRSSNamespace());
    if (description != null) {
        item.setDescription(parseItemDescription(rssRoot, description));
    }

    final Element encoded = eItem.getChild("encoded", getContentNamespace());
    if (encoded != null) {
        final Content content = new Content();
        content.setType(Content.HTML);
        content.setValue(encoded.getText());
        item.setContent(content);
    }

    return item;

}
 
开发者ID:rometools,项目名称:rome,代码行数:33,代码来源:RSS091UserlandParser.java


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