List of usage examples for org.jdom2 Element addContent
@Override public Element addContent(final Collection<? extends Content> newContent)
From source file:com.rometools.rome.io.impl.RSS090Generator.java
License:Open Source License
/** * Populates the given channel with parsed data from the ROME element that holds the channel * data./* ww w . ja v a 2 s. c om*/ * * @param channel the channel into which parsed data will be added. * @param eChannel the XML element that holds the data for the channel. */ protected void populateChannel(final Channel channel, final Element eChannel) { final String title = channel.getTitle(); if (title != null) { eChannel.addContent(generateSimpleElement("title", title)); } final String link = channel.getLink(); if (link != null) { eChannel.addContent(generateSimpleElement("link", link)); } final String description = channel.getDescription(); if (description != null) { eChannel.addContent(generateSimpleElement("description", description)); } }
From source file:com.rometools.rome.io.impl.RSS090Generator.java
License:Open Source License
protected void addImage(final Channel channel, final Element parent) throws FeedException { final Image image = channel.getImage(); if (image != null) { final Element eImage = new Element("image", getFeedNamespace()); populateImage(image, eImage);/*from w w w . j a v a 2 s . co m*/ checkImageConstraints(eImage); parent.addContent(eImage); } }
From source file:com.rometools.rome.io.impl.RSS090Generator.java
License:Open Source License
protected void populateImage(final Image image, final Element eImage) { final String title = image.getTitle(); if (title != null) { eImage.addContent(generateSimpleElement("title", title)); }//from w w w . j a v a2s .c o m final String url = image.getUrl(); if (url != null) { eImage.addContent(generateSimpleElement("url", url)); } final String link = image.getLink(); if (link != null) { eImage.addContent(generateSimpleElement("link", link)); } }
From source file:com.rometools.rome.io.impl.RSS090Generator.java
License:Open Source License
protected void addTextInput(final Channel channel, final Element parent) throws FeedException { final TextInput textInput = channel.getTextInput(); if (textInput != null) { final Element eTextInput = new Element(getTextInputLabel(), getFeedNamespace()); populateTextInput(textInput, eTextInput); checkTextInputConstraints(eTextInput); parent.addContent(eTextInput); }//from ww w. j a v a 2 s .co m }
From source file:com.rometools.rome.io.impl.RSS090Generator.java
License:Open Source License
protected void populateTextInput(final TextInput textInput, final Element eTextInput) { final String title = textInput.getTitle(); if (title != null) { eTextInput.addContent(generateSimpleElement("title", title)); }//w w w . j ava 2 s . c om final String description = textInput.getDescription(); if (description != null) { eTextInput.addContent(generateSimpleElement("description", description)); } final String name = textInput.getName(); if (name != null) { eTextInput.addContent(generateSimpleElement("name", name)); } final String link = textInput.getLink(); if (link != null) { eTextInput.addContent(generateSimpleElement("link", link)); } }
From source file:com.rometools.rome.io.impl.RSS090Generator.java
License:Open Source License
protected void addItem(final Item item, final Element parent, final int index) throws FeedException { final Element eItem = new Element("item", getFeedNamespace()); populateItem(item, eItem, index);//w ww. j a v a2 s. com checkItemConstraints(eItem); generateItemModules(item.getModules(), eItem); parent.addContent(eItem); }
From source file:com.rometools.rome.io.impl.RSS090Generator.java
License:Open Source License
protected void populateItem(final Item item, final Element eItem, final int index) { final String title = item.getTitle(); if (title != null) { eItem.addContent(generateSimpleElement("title", title)); }//from ww w .j a v a 2 s. c om final String link = item.getLink(); if (link != null) { eItem.addContent(generateSimpleElement("link", link)); } generateForeignMarkup(eItem, item.getForeignMarkup()); }
From source file:com.rometools.rome.io.impl.RSS091UserlandGenerator.java
License:Open Source License
protected Element generateSkipDaysElement(final List<String> days) { final Element skipDaysElement = new Element("skipDays"); for (final String day : days) { skipDaysElement.addContent(generateSimpleElement("day", day.toString())); }/* w w w. j a v a2s . c o m*/ return skipDaysElement; }
From source file:com.rometools.rome.io.impl.RSS091UserlandGenerator.java
License:Open Source License
protected Element generateSkipHoursElement(final List<Integer> hours) { final Element skipHoursElement = new Element("skipHours", getFeedNamespace()); for (final Integer hour : hours) { skipHoursElement.addContent(generateSimpleElement("hour", hour.toString())); }/*from ww w . j av a 2 s .c o m*/ return skipHoursElement; }
From source file:com.rometools.rome.io.impl.RSS091UserlandGenerator.java
License:Open Source License
@Override protected void populateChannel(final Channel channel, final Element eChannel) { super.populateChannel(channel, eChannel); final String language = channel.getLanguage(); if (language != null) { eChannel.addContent(generateSimpleElement("language", language)); }/*from w w w . j av a2s .c om*/ final String rating = channel.getRating(); if (rating != null) { eChannel.addContent(generateSimpleElement("rating", rating)); } final String copyright = channel.getCopyright(); if (copyright != null) { eChannel.addContent(generateSimpleElement("copyright", copyright)); } final Date pubDate = channel.getPubDate(); if (pubDate != null) { eChannel.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate, Locale.US))); } final Date lastBuildDate = channel.getLastBuildDate(); if (lastBuildDate != null) { eChannel.addContent( generateSimpleElement("lastBuildDate", DateParser.formatRFC822(lastBuildDate, Locale.US))); } final String docs = channel.getDocs(); if (docs != null) { eChannel.addContent(generateSimpleElement("docs", docs)); } final String managingEditor = channel.getManagingEditor(); if (managingEditor != null) { eChannel.addContent(generateSimpleElement("managingEditor", managingEditor)); } final String webMaster = channel.getWebMaster(); if (webMaster != null) { eChannel.addContent(generateSimpleElement("webMaster", webMaster)); } final List<Integer> skipHours = channel.getSkipHours(); if (skipHours != null && !skipHours.isEmpty()) { eChannel.addContent(generateSkipHoursElement(skipHours)); } final List<String> skipDays = channel.getSkipDays(); if (skipDays != null && !skipDays.isEmpty()) { eChannel.addContent(generateSkipDaysElement(skipDays)); } }