Example usage for org.jdom2 Element Element

List of usage examples for org.jdom2 Element Element

Introduction

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

Prototype

public Element(final String name, final String uri) 

Source Link

Document

Creates a new element with the supplied (local) name and a namespace given by a URI.

Usage

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);/*w  w  w  . ja v a 2 s.c  om*/
        checkImageConstraints(eImage);
        parent.addContent(eImage);
    }
}

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.jav  a  2s.  c  om*/
    }
}

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);/*w  w  w  .  j  av  a  2 s  .c o m*/
    checkItemConstraints(eItem);
    generateItemModules(item.getModules(), eItem);
    parent.addContent(eItem);
}

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

License:Open Source License

protected Element createRootElement(Channel channel) {
    Element root = new Element("rss", getFeedNamespace());
    Attribute version = new Attribute("version", getVersion());
    root.setAttribute(version);//from  ww w .  j a v a 2 s .  c  om
    root.addNamespaceDeclaration(getContentNamespace());
    generateModuleNamespaceDefs(root);

    return root;
}

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()));
    }//w w w .  ja  va 2s . c  o m

    return skipHoursElement;
}

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 w w  w  .j a v  a2s.  c  o  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 Element generateCloud(Cloud cloud) {
    Element eCloud = new Element("cloud", getFeedNamespace());

    if (cloud.getDomain() != null) {
        eCloud.setAttribute(new Attribute("domain", cloud.getDomain()));
    }/*w ww  . j a v  a  2  s  .c o  m*/

    if (cloud.getPort() != 0) {
        eCloud.setAttribute(new Attribute("port", String.valueOf(cloud.getPort())));
    }

    if (cloud.getPath() != null) {
        eCloud.setAttribute(new Attribute("path", cloud.getPath()));
    }

    if (cloud.getRegisterProcedure() != null) {
        eCloud.setAttribute(new Attribute("registerProcedure", cloud.getRegisterProcedure()));
    }

    if (cloud.getProtocol() != null) {
        eCloud.setAttribute(new Attribute("protocol", cloud.getProtocol()));
    }
    return eCloud;
}

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  w  w  . j a va2 s.  c o m
    sourceElement.addContent(source.getValue());
    return sourceElement;
}

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

License:Open Source License

protected Element generateEnclosure(Enclosure enclosure) {
    Element enclosureElement = new Element("enclosure", getFeedNamespace());
    if (enclosure.getUrl() != null) {
        enclosureElement.setAttribute("url", enclosure.getUrl());
    }//from  w ww .  j  av a2  s.  co  m
    if (enclosure.getLength() != 0) {
        enclosureElement.setAttribute("length", String.valueOf(enclosure.getLength()));
    }
    if (enclosure.getType() != null) {
        enclosureElement.setAttribute("type", enclosure.getType());
    }
    return enclosureElement;
}

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());
    }//from  w ww  . j a  v  a 2s  .co m
    categoryElement.addContent(category.getValue());
    return categoryElement;
}