Java Code Examples for com.rometools.rome.feed.rss.Item#setUri()
The following examples show how to use
com.rometools.rome.feed.rss.Item#setUri() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConverterForRSS10.java From rome with Apache License 2.0 | 6 votes |
@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; }
Example 2
Source File: RSS10Parser.java From rome with Apache License 2.0 | 6 votes |
/** * 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; }
Example 3
Source File: RSS090Parser.java From rome with Apache License 2.0 | 5 votes |
/** * 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(final Element rssRoot, final Element eItem, final Locale locale) { final Item item = new Item(); final Element title = eItem.getChild("title", getRSSNamespace()); if (title != null) { item.setTitle(title.getText()); } final Element link = eItem.getChild("link", getRSSNamespace()); if (link != null) { item.setLink(link.getText()); item.setUri(link.getText()); } item.setModules(parseItemModules(eItem, locale)); final List<Element> foreignMarkup = extractForeignMarkup(eItem, item, getRSSNamespace()); // content:encoded elements are treated special, without a module, they have to be removed // from the foreign markup to avoid duplication in case of read/write. Note that this fix // will break if a content module is used final Iterator<Element> iterator = foreignMarkup.iterator(); while (iterator.hasNext()) { final Element element = iterator.next(); final Namespace eNamespace = element.getNamespace(); final String eName = element.getName(); if (getContentNamespace().equals(eNamespace) && eName.equals("encoded")) { iterator.remove(); } } if (!foreignMarkup.isEmpty()) { item.setForeignMarkup(foreignMarkup); } return item; }
Example 4
Source File: ConverterForRSS090.java From rome with Apache License 2.0 | 4 votes |
protected Item createRSSItem(final SyndEntry sEntry) { final Item item = new Item(); item.setModules(ModuleUtils.cloneModules(sEntry.getModules())); item.setTitle(sEntry.getTitle()); item.setLink(sEntry.getLink()); final List<Element> foreignMarkup = sEntry.getForeignMarkup(); if (!foreignMarkup.isEmpty()) { item.setForeignMarkup(foreignMarkup); } item.setSource(createSource(sEntry.getSource())); final String uri = sEntry.getUri(); if (uri != null) { item.setUri(uri); } return item; }