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

Java Item类代码示例

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

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



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

示例1: parseItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It reads title and link out of the 'item' element.
 * <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.
 */
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = new Item();
    Element e = eItem.getChild("title",getRSSNamespace());
    if (e!=null) {
        item.setTitle(e.getText());
    }
    e = eItem.getChild("link",getRSSNamespace());
    if (e!=null) {
        item.setLink(e.getText());
    }
    
    item.setModules(parseItemModules(eItem));

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


示例2: populateItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected void populateItem(Item item, Element eItem, int index) {
    super.populateItem(item,eItem, index);
    String link = item.getLink();
    String uri = item.getUri();
    
    if (uri != null) {
        eItem.setAttribute("about", uri, getRDFNamespace());
    } else if (link != null) {
        eItem.setAttribute("about", link, getRDFNamespace());
    }
    
    Description description = item.getDescription();
    if (description!=null) {
        eItem.addContent(generateSimpleElement("description",description.getValue()));
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:RSS10Generator.java


示例3: populateItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected void populateItem(Item item, Element eItem, int index) {
    super.populateItem(item,eItem, index);

    Element eDescription = eItem.getChild("description",getFeedNamespace());
    //TODO FIX THIS, TEST FOR NULL BEFORE DOING SO
    eDescription.removeAttribute("type");

    String author = item.getAuthor();
    if (author != null) {
        eItem.addContent(generateSimpleElement("author", author));
    }

    String comments = item.getComments();
    if (comments != null) {
        eItem.addContent(generateSimpleElement("comments", comments));
    }

    Guid guid = item.getGuid();
    if (guid != null) {
        Element eGuid = generateSimpleElement("guid",guid.getValue());
        if (!guid.isPermaLink()) {
            eGuid.setAttribute("isPermaLink", "false");
        }
        eItem.addContent(eGuid);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:27,代码来源:RSS20Generator.java


示例4: createSyndEntry

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected SyndEntry createSyndEntry(Item item) {
    SyndEntry syndEntry = super.createSyndEntry(item);

    Description desc = item.getDescription();
    if (desc!=null) {
        SyndContent content = new SyndContentImpl();
        content.setType(desc.getType());
        content.setValue(desc.getValue());
        syndEntry.setDescription(content);

        // contents[0] and description then reference the same content
        //
        List contents = new ArrayList();
        contents.add(content);
        syndEntry.setContents(contents);

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


示例5: createSyndEntry

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected SyndEntry createSyndEntry(Item item) {
    SyndEntry syndEntry = super.createSyndEntry(item);
    Description desc = item.getDescription();
    if (desc!=null) {
        SyndContent content = new SyndContentImpl();
        content.setType(desc.getType());
        content.setValue(desc.getValue());
        syndEntry.setDescription(content);

        // contents[0] and description then reference the same content
        //
        List contents = new ArrayList();
        contents.add(content);
        syndEntry.setContents(contents);

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


示例6: parseItem

import com.sun.syndication.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.
 */
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = super.parseItem(rssRoot,eItem);
    Element e = eItem.getChild("description",getRSSNamespace());
    if (e!=null) {
        item.setDescription(parseItemDescription(rssRoot,e));
    }

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

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


示例7: parseItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = super.parseItem(rssRoot,eItem);
    Element e = eItem.getChild("pubDate",getRSSNamespace());
    if (e!=null) {
        item.setPubDate(DateParser.parseRFC822(e.getText()));
    }
    e = eItem.getChild("expirationDate",getRSSNamespace());
    if (e!=null) {
        item.setExpirationDate(DateParser.parseRFC822(e.getText()));
    }
    e = eItem.getChild("description",getRSSNamespace());
    if (e!=null) {
        String type = e.getAttributeValue("type");
        if (type!=null) {
            item.getDescription().setType(type);
        }
    }
    return item;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:RSS093Parser.java


示例8: parseItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = super.parseItem(rssRoot,eItem);
    item.setExpirationDate(null);

    Element e = eItem.getChild("author",getRSSNamespace());
    if (e!=null) {
        item.setAuthor(e.getText());
    }

    e = eItem.getChild("guid",getRSSNamespace());
    if (e!=null) {
        Guid guid = new Guid();
        String att = e.getAttributeValue("isPermaLink");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            guid.setPermaLink(att.equalsIgnoreCase("true"));
        }
        guid.setValue(e.getText());
        item.setGuid(guid);
    }

    e = eItem.getChild("comments",getRSSNamespace());
    if (e!=null) {
        item.setComments(e.getText());
    }

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


示例9: populateChannel

import com.sun.syndication.feed.rss.Item; //导入依赖的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


示例10: populateItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected void populateItem(Item item, Element eItem, int index) {
    super.populateItem(item,eItem, index);

    Description description = item.getDescription();
    if (description!=null && description.getType()!=null) {
        Element eDescription = eItem.getChild("description",getFeedNamespace());
        eDescription.setAttribute(new Attribute("type",description.getType()));
    }
    eItem.removeChild("expirationDate",getFeedNamespace());
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:RSS094Generator.java


示例11: buildFeedItems

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    Collection<Message> messages = (Collection<Message>) model.get("messages");
    List<Item> items = new ArrayList<Item>(messages.size());

    for (Message message : messages) {
        Item item = new Item();
        item.setAuthor(message.getAuthor().getNames() + " (@" + message.getAuthor().getUsername()
                + ")");
        item.setPubDate(message.getDateTime().toDate());
        item.setLink(baseUrl + "/message/" + message.getId());
        String[] lines = WordUtils.wrap(message.getText(), 60).split(
                System.getProperty("line.separator"));
        item.setTitle(lines[0] + (lines.length == 1 ? "" : "..."));
        Description desc = new Description();
        desc.setValue(message.getData().getFormattedText());
        item.setDescription(desc);
        items.add(item);
    }

    return items;
}
 
开发者ID:Glamdring,项目名称:welshare,代码行数:25,代码来源:MessageController.java


示例12: createSyndEntry

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
	SyndEntryImpl syndEntry = new SyndEntryImpl();
	if (preserveWireItem) {
		syndEntry.setWireEntry(item);
	}
	
    syndEntry.setModules(ModuleUtils.cloneModules(item.getModules()));
    
    if (((List)item.getForeignMarkup()).size() > 0) {
        syndEntry.setForeignMarkup(item.getForeignMarkup());
    }
    
    syndEntry.setUri(item.getUri());
    syndEntry.setLink(item.getLink());
    syndEntry.setTitle(item.getTitle());
    syndEntry.setLink(item.getLink());
    return syndEntry;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:19,代码来源:ConverterForRSS090.java


示例13: createRSSItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = new Item();
    item.setModules(ModuleUtils.cloneModules(sEntry.getModules()));
    item.setTitle(sEntry.getTitle());
    item.setLink(sEntry.getLink());
    if (((List)sEntry.getForeignMarkup()).size() > 0) {
        item.setForeignMarkup(sEntry.getForeignMarkup());
    }

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


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


示例14: createSyndEntry

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
@Override
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
    SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

    Description desc = item.getDescription();
    if (desc!=null) {
        SyndContent descContent = new SyndContentImpl();
        descContent.setType(desc.getType());
        descContent.setValue(desc.getValue());
        syndEntry.setDescription(descContent);
    }
    Content cont = item.getContent();
    if (cont!=null) {
        SyndContent contContent = new SyndContentImpl();
        contContent.setType(cont.getType());
        contContent.setValue(cont.getValue());
        List contents = new ArrayList();
        contents.add(contContent);
        syndEntry.setContents(contents);
    }
            
    return syndEntry;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:24,代码来源:ConverterForRSS10.java


示例15: createRSSItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
@Override
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent desc = sEntry.getDescription();
    if (desc!=null) {
        item.setDescription(createItemDescription(desc));
    }
    List contents = sEntry.getContents();
    if (contents!=null && contents.size() > 0) {
        item.setContent(createItemContent((SyndContent)contents.get(0)));
    }
    
    String uri = sEntry.getUri();
    if (uri != null) {
        item.setUri(uri);
    }
    
    return item;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:21,代码来源:ConverterForRSS10.java


示例16: createRSSItem

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
@Override
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent sContent = sEntry.getDescription();

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

    List contents = sEntry.getContents();

    if ((contents != null) && (contents.size() > 0)) {
        SyndContent syndContent = (SyndContent) contents.get(0);
        Content cont = new Content();
        cont.setValue(syndContent.getValue());
        cont.setType(syndContent.getType());
        item.setContent(cont);
    }

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


示例17: createSyndEntry

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
@Override
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
    SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
    Description desc = item.getDescription();

    if (desc != null) {
        SyndContent descContent = new SyndContentImpl();
        descContent.setType(desc.getType());
        descContent.setValue(desc.getValue());
        syndEntry.setDescription(descContent);
    }

    Content cont = item.getContent();

    if (cont != null) {
        SyndContent content = new SyndContentImpl();
        content.setType(cont.getType());
        content.setValue(cont.getValue());

        List syndContents = new ArrayList();
        syndContents.add(content);
        syndEntry.setContents(syndContents);
    }

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


示例18: createSyndEntry

import com.sun.syndication.feed.rss.Item; //导入依赖的package包/类
@Override
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
    SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
    List cats =  item.getCategories();
    if (cats.size()>0) {
        Set s = new LinkedHashSet();                // using a set to remove duplicates and use a LinkedHashSet to try to retain the document order
        s.addAll(createSyndCategories(cats)); // feed native categories (as syndcat)
        s.addAll(syndEntry.getCategories());   // DC subjects (as syndcat)
        syndEntry.setCategories(new ArrayList(s));    //c
    }
    List enclosures = item.getEnclosures();
    if (enclosures.size()>0) {
        syndEntry.setEnclosures(createSyndEnclosures(enclosures));
    }
    return syndEntry;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:17,代码来源:ConverterForRSS092.java


示例19: parseItem

import com.sun.syndication.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.
 */
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = super.parseItem(rssRoot,eItem);
    Element e = eItem.getChild("description", getRSSNamespace());
    if (e!=null) {
        item.setDescription(parseItemDescription(rssRoot,e));
    }
    Element ce = eItem.getChild("encoded", getContentNamespace());
    if (ce != null) {
        Content content = new Content();
        content.setType(Content.HTML);
        content.setValue(ce.getText());
        item.setContent(content);
    }

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

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


示例20: parseItem

import com.sun.syndication.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.
 */
protected Item parseItem(Element rssRoot, Element eItem) {
    Item item = super.parseItem(rssRoot,eItem);
    Element e = eItem.getChild("description", getRSSNamespace());
    if (e!=null) {
        item.setDescription(parseItemDescription(rssRoot,e));
    }
    Element ce = eItem.getChild("encoded", getContentNamespace());
    if (ce != null) {
        Content content = new Content();
        content.setType(Content.HTML);
        content.setValue(ce.getText());
        item.setContent(content);
    }
    return item;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:26,代码来源:RSS091UserlandParser.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ResourceAdapterArchive类代码示例发布时间:2022-05-22
下一篇:
Java FileJournalManager类代码示例发布时间: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