Example usage for org.jdom2 Element addContent

List of usage examples for org.jdom2 Element addContent

Introduction

In this page you can find the example usage for org.jdom2 Element addContent.

Prototype

@Override
public Element addContent(final Collection<? extends Content> newContent) 

Source Link

Document

Appends all children in the given collection to the end of the content list.

Usage

From source file:com.sun.syndication.io.impl.DCModuleGenerator.java

License:Open Source License

/**
 * Utility method to generate a single element containing a string.
 * <p>//from  ww  w . j av a  2 s  .  c o  m
 * @param name the name of the elment to generate.
 * @param value the value of the text in the element.
 * @return the element generated.
 */
protected final Element generateSimpleElement(String name, String value) {
    Element element = new Element(name, getDCNamespace());
    element.addContent(value);

    return element;
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

protected void addChannel(Channel channel, Element parent) throws FeedException {
    Element eChannel = new Element("channel", getFeedNamespace());
    populateChannel(channel, eChannel);//ww  w.j  a v  a  2s  . c  om
    checkChannelConstraints(eChannel);
    parent.addContent(eChannel);
    generateFeedModules(channel.getModules(), eChannel);
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

/**
 * Populates the given channel with parsed data from the ROME element that holds the
 * channel data./*www .j a  va  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(Channel channel, Element eChannel) {
    String title = channel.getTitle();
    if (title != null) {
        eChannel.addContent(generateSimpleElement("title", title));
    }
    String link = channel.getLink();
    if (link != null) {
        eChannel.addContent(generateSimpleElement("link", link));
    }
    String description = channel.getDescription();
    if (description != null) {
        eChannel.addContent(generateSimpleElement("description", description));
    }
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

protected void addImage(Channel channel, Element parent) throws FeedException {
    Image image = channel.getImage();
    if (image != null) {
        Element eImage = new Element("image", getFeedNamespace());
        populateImage(image, eImage);/*from  ww w . j a  va2 s  .c  o  m*/
        checkImageConstraints(eImage);
        parent.addContent(eImage);
    }
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

protected void populateImage(Image image, Element eImage) {
    String title = image.getTitle();
    if (title != null) {
        eImage.addContent(generateSimpleElement("title", title));
    }/*from   ww  w . j a  v a 2  s . c  o  m*/
    String url = image.getUrl();
    if (url != null) {
        eImage.addContent(generateSimpleElement("url", url));
    }
    String link = image.getLink();
    if (link != null) {
        eImage.addContent(generateSimpleElement("link", link));
    }
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

protected void addTextInput(Channel channel, Element parent) throws FeedException {
    TextInput textInput = channel.getTextInput();
    if (textInput != null) {
        Element eTextInput = new Element(getTextInputLabel(), getFeedNamespace());
        populateTextInput(textInput, eTextInput);
        checkTextInputConstraints(eTextInput);
        parent.addContent(eTextInput);
    }//  w  w w . j  a va  2 s  . c om
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

protected void populateTextInput(TextInput textInput, Element eTextInput) {
    String title = textInput.getTitle();
    if (title != null) {
        eTextInput.addContent(generateSimpleElement("title", title));
    }/*from   w ww .  jav  a  2s .c o m*/
    String description = textInput.getDescription();
    if (description != null) {
        eTextInput.addContent(generateSimpleElement("description", description));
    }
    String name = textInput.getName();
    if (name != null) {
        eTextInput.addContent(generateSimpleElement("name", name));
    }
    String link = textInput.getLink();
    if (link != null) {
        eTextInput.addContent(generateSimpleElement("link", link));
    }
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

protected void addItem(Item item, Element parent, int index) throws FeedException {
    Element eItem = new Element("item", getFeedNamespace());
    populateItem(item, eItem, index);//from  w ww  . j  a  v  a2  s  . c  om
    checkItemConstraints(eItem);
    generateItemModules(item.getModules(), eItem);
    parent.addContent(eItem);
}

From source file:com.sun.syndication.io.impl.RSS090Generator.java

License:Open Source License

protected void populateItem(Item item, Element eItem, int index) {
    String title = item.getTitle();
    if (title != null) {
        eItem.addContent(generateSimpleElement("title", title));
    }/*from w w  w  . ja  va 2  s .  c  o  m*/
    String link = item.getLink();
    if (link != null) {
        eItem.addContent(generateSimpleElement("link", link));
    }
    generateForeignMarkup(eItem, (List) item.getForeignMarkup());
}

From source file:com.sun.syndication.io.impl.RSS091UserlandGenerator.java

License:Open Source License

protected Element generateSkipDaysElement(List days) {
    Element skipDaysElement = new Element("skipDays");

    for (int i = 0; i < days.size(); i++) {
        skipDaysElement.addContent(generateSimpleElement("day", days.get(i).toString()));
    }// w  w w  .  jav a 2 s. c  o m

    return skipDaysElement;
}