List of usage examples for org.jdom2 Element addContent
@Override public Element addContent(final Collection<? extends Content> newContent)
From source file:com.sun.syndication.io.impl.RSS091UserlandGenerator.java
License:Open Source License
protected Element generateSkipHoursElement(List hours) { Element skipHoursElement = new Element("skipHours", getFeedNamespace()); for (int i = 0; i < hours.size(); i++) { skipHoursElement.addContent(generateSimpleElement("hour", hours.get(i).toString())); }//from w ww. j a v a 2 s . com return skipHoursElement; }
From source file:com.sun.syndication.io.impl.RSS091UserlandGenerator.java
License:Open Source License
protected void populateChannel(Channel channel, Element eChannel) { super.populateChannel(channel, eChannel); String language = channel.getLanguage(); if (language != null) { eChannel.addContent(generateSimpleElement("language", language)); }/*ww w.j a v a 2s. c om*/ String rating = channel.getRating(); if (rating != null) { eChannel.addContent(generateSimpleElement("rating", rating)); } String copyright = channel.getCopyright(); if (copyright != null) { eChannel.addContent(generateSimpleElement("copyright", copyright)); } Date pubDate = channel.getPubDate(); if (pubDate != null) { eChannel.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate))); } Date lastBuildDate = channel.getLastBuildDate(); if (lastBuildDate != null) { eChannel.addContent(generateSimpleElement("lastBuildDate", DateParser.formatRFC822(lastBuildDate))); } String docs = channel.getDocs(); if (docs != null) { eChannel.addContent(generateSimpleElement("docs", docs)); } String managingEditor = channel.getManagingEditor(); if (managingEditor != null) { eChannel.addContent(generateSimpleElement("managingEditor", managingEditor)); } String webMaster = channel.getWebMaster(); if (webMaster != null) { eChannel.addContent(generateSimpleElement("webMaster", webMaster)); } List skipHours = channel.getSkipHours(); if ((skipHours != null) && (skipHours.size() > 0)) { eChannel.addContent(generateSkipHoursElement(skipHours)); } List skipDays = channel.getSkipDays(); if ((skipDays != null) && (skipDays.size() > 0)) { eChannel.addContent(generateSkipDaysElement(skipDays)); } }
From source file:com.sun.syndication.io.impl.RSS091UserlandGenerator.java
License:Open Source License
protected void populateImage(Image image, Element eImage) { super.populateImage(image, eImage); Integer width = image.getWidth(); if (width != null) { eImage.addContent(generateSimpleElement("width", String.valueOf(width))); }/*from w ww . j av a 2 s . c o m*/ Integer height = image.getHeight(); if (height != null) { eImage.addContent(generateSimpleElement("height", String.valueOf(height))); } String description = image.getDescription(); if (description != null) { eImage.addContent(generateSimpleElement("description", description)); } }
From source file:com.sun.syndication.io.impl.RSS091UserlandGenerator.java
License:Open Source License
protected void populateItem(Item item, Element eItem, int index) { super.populateItem(item, eItem, index); Description description = item.getDescription(); if (description != null) { eItem.addContent(generateSimpleElement("description", description.getValue())); }/*from ww w . j a v a 2 s .co m*/ if ((item.getModule(getContentNamespace().getURI()) == null) && (item.getContent() != null)) { Element elem = new Element("encoded", getContentNamespace()); elem.addContent(item.getContent().getValue()); eItem.addContent(elem); } }
From source file:com.sun.syndication.io.impl.RSS092Generator.java
License:Open Source License
protected void populateChannel(Channel channel, Element eChannel) { super.populateChannel(channel, eChannel); Cloud cloud = channel.getCloud();/*from www. j ava2 s. co m*/ if (cloud != null) { eChannel.addContent(generateCloud(cloud)); } }
From source file:com.sun.syndication.io.impl.RSS092Generator.java
License:Open Source License
protected void populateItem(Item item, Element eItem, int index) { super.populateItem(item, eItem, index); Source source = item.getSource(); if (source != null) { eItem.addContent(generateSourceElement(source)); }//w ww . j a va2 s .co m List enclosures = item.getEnclosures(); for (int i = 0; i < getNumberOfEnclosures(enclosures); i++) { eItem.addContent(generateEnclosure((Enclosure) enclosures.get(i))); } List categories = item.getCategories(); for (int i = 0; i < categories.size(); i++) { eItem.addContent(generateCategoryElement((Category) categories.get(i))); } }
From source file:com.sun.syndication.io.impl.RSS092Generator.java
License:Open Source License
protected Element generateSourceElement(Source source) { Element sourceElement = new Element("source", getFeedNamespace()); if (source.getUrl() != null) { sourceElement.setAttribute(new Attribute("url", source.getUrl())); }/*from w ww .j a v a2 s .c om*/ sourceElement.addContent(source.getValue()); return sourceElement; }
From source file:com.sun.syndication.io.impl.RSS092Generator.java
License:Open Source License
protected Element generateCategoryElement(Category category) { Element categoryElement = new Element("category", getFeedNamespace()); if (category.getDomain() != null) { categoryElement.setAttribute("domain", category.getDomain()); }// w w w . j ava 2 s. co m categoryElement.addContent(category.getValue()); return categoryElement; }
From source file:com.sun.syndication.io.impl.RSS093Generator.java
License:Open Source License
protected void populateItem(Item item, Element eItem, int index) { super.populateItem(item, eItem, index); Date pubDate = item.getPubDate(); if (pubDate != null) { eItem.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate))); }/*from ww w.j a v a2 s . c om*/ Date expirationDate = item.getExpirationDate(); if (expirationDate != null) { eItem.addContent(generateSimpleElement("expirationDate", DateParser.formatRFC822(expirationDate))); } }
From source file:com.sun.syndication.io.impl.RSS10Generator.java
License:Open Source License
protected void populateChannel(Channel channel, Element eChannel) { super.populateChannel(channel, eChannel); if (channel.getUri() != null) { eChannel.setAttribute("about", channel.getUri(), getRDFNamespace()); }//from w ww . j a v a 2 s .c om 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 uri = item.getUri(); if (uri != null) { eLi.setAttribute("resource", uri, getRDFNamespace()); } eSeq.addContent(eLi); } eItems.addContent(eSeq); eChannel.addContent(eItems); } }