// Create an RSS Parser RssParser parser = RssParserFactory.createDefault(); // Parse the feed Rss rss = parser.parse( new URL( YOUR_FEED ) ); // Get the channel Channel channel = rss.getChannel(); // Get the items Collection<Item> items = channel.getItems(); // Loop for each item for ( Item item : items ) { // Get the GUID Guid guid = item.getGuid(); // Loop for each of the previously seen GUIDs and compare }
public void populateItem(Item item, Element eItem, int index) { super.populateItem(item,eItem, index); Element eDescription = eItem.getChild("description",getFeedNamespace()); if (eDescription != null) 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); } }
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) { SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem); // adding native feed author to DC creators list String author = item.getAuthor(); if (author!=null) { List creators = ((DCModule)syndEntry.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); } } Guid guid = item.getGuid(); if (guid!=null) { syndEntry.setUri(guid.getValue()); if (item.getLink()==null && guid.isPermaLink()) { syndEntry.setLink(guid.getValue()); } } else { syndEntry.setUri(item.getLink()); } return syndEntry; }
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) { SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem); // adding native feed author to DC creators list String author = item.getAuthor(); if (author!=null) { List creators = ((DCModule)syndEntry.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); } } Guid guid = item.getGuid(); if (guid!=null) { syndEntry.setUri(guid.getValue()); if (item.getLink()==null && guid.isPermaLink()) { syndEntry.setLink(guid.getValue()); } } else { syndEntry.setUri(item.getLink()); } return syndEntry; }
public void populateItem(Item item, Element eItem, int index) { super.populateItem(item,eItem, index); Element eDescription = eItem.getChild("description",getFeedNamespace()); if (eDescription != null) 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); } }
Guid guid = item.getGuid(); if (guid!=null) { syndEntry.setUri(guid.getValue());
Guid guid = item.getGuid(); if (guid!=null) { syndEntry.setUri(guid.getValue());
public void populateItem(Item item, Element eItem, int index) { super.populateItem(item,eItem, index); Element eDescription = eItem.getChild("description",getFeedNamespace()); if (eDescription != null) 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); } }
public void populateItem(Item item, Element eItem, int index) { super.populateItem(item,eItem, index); Element eDescription = eItem.getChild("description",getFeedNamespace()); if (eDescription != null) 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); } }
createStringProperty(r_entry, NS_DC_TERMS + "identifier", entry.getGuid().getValue());
createStringProperty(r_entry, NS_DC_TERMS + "identifier", entry.getGuid().getValue());