Package com.rometools.rome.feed.rss

Examples of com.rometools.rome.feed.rss.Description


    protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
      List<Item> items = new ArrayList<Item>();
      for (String name : model.keySet()) {
        Item item = new Item();
        item.setTitle(name);
        Description description = new Description();
        description.setValue((String) model.get(name));
        item.setDescription(description);
        items.add(item);
      }
      return items;
    }
View Full Code Here


  @Override
  protected Item parseItem(Element rssRoot, Element eItem, Locale locale) {
    Item item = super.parseItem(rssRoot, eItem, locale);
    Element e = eItem.getChild("description", getRSSNamespace());
    if (e != null) {
      Description desc = new Description();
      desc.setValue(e.getText());
      item.setDescription(desc);
    }

    return item;
  }
View Full Code Here

public class RSS090DescriptionConverter extends ConverterForRSS090 {

  @Override
  protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
    SyndEntry entry = super.createSyndEntry(item, preserveWireItem);
    Description desc = item.getDescription();
    if (desc != null) {
      SyndContentImpl syndDesc = new SyndContentImpl();
      syndDesc.setValue(desc.getValue());
      entry.setDescription(syndDesc);
    }
    return entry;
  }
View Full Code Here

    @Override
    protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

        final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

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

        final Content cont = item.getContent();
        if (cont != null) {
View Full Code Here

        return item;
    }

    protected Description createItemDescription(final SyndContent sContent) {
        final Description desc = new Description();
        desc.setValue(sContent.getValue());
        desc.setType(sContent.getType());
        return desc;
    }
View Full Code Here

    @Override
    protected void populateItem(final Item item, final Element eItem, final int index) {
        super.populateItem(item, eItem, index);

        final Description description = item.getDescription();
        if (description != null && description.getType() != null) {
            final Element eDescription = eItem.getChild("description", getFeedNamespace());
            eDescription.setAttribute(new Attribute("type", description.getType()));
        }
        eItem.removeChild("expirationDate", getFeedNamespace());
    }
View Full Code Here

    }

    @Override
    protected Description parseItemDescription(final Element rssRoot, final Element eDesc) {
        final Description desc = new Description();
        final StringBuilder sb = new StringBuilder();
        final XMLOutputter xmlOut = new XMLOutputter();
        for (final Content c : eDesc.getContent()) {
            switch (c.getCType()) {
                case Text:
                case CDATA:
                    sb.append(c.getValue());
                    break;
                case EntityRef:
                    LOG.debug("Entity: {}", c.getValue());
                    sb.append(c.getValue());
                    break;
                case Element:
                    sb.append(xmlOut.outputString((Element) c));
                    break;
                default:
                    // ignore
                    break;
            }
        }
        desc.setValue(sb.toString());
        String att = eDesc.getAttributeValue("type");
        if (att == null) {
            att = "text/html";
        }
        desc.setType(att);
        return desc;
    }
View Full Code Here

            eItem.setAttribute("about", uri, getRDFNamespace());
        } else if (link != null) {
            eItem.setAttribute("about", link, getRDFNamespace());
        }

        final Description description = item.getDescription();
        if (description != null) {
            eItem.addContent(generateSimpleElement("description", description.getValue()));
        }

        if (item.getModule(getContentNamespace().getURI()) == null && item.getContent() != null) {
            final Element elem = new Element("encoded", getContentNamespace());
            elem.addContent(item.getContent().getValue());
View Full Code Here

        return false;
    }

    @Override
    protected Description parseItemDescription(final Element rssRoot, final Element eDesc) {
        final Description desc = super.parseItemDescription(rssRoot, eDesc);
        return desc;
    }
View Full Code Here

        return item;

    }

    protected Description parseItemDescription(final Element rssRoot, final Element eDesc) {
        final Description desc = new Description();
        desc.setType("text/plain");
        desc.setValue(eDesc.getText());
        return desc;
    }
View Full Code Here

TOP

Related Classes of com.rometools.rome.feed.rss.Description

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.