Package org.jdom2

Examples of org.jdom2.Attribute


        }
        return attribute;
    }

    protected String getAttributeValue(final Element e, final String attributeName) {
        final Attribute attr = getAttribute(e, attributeName);
        if (attr != null) {
            return attr.getValue();
        } else {
            return null;
        }
    }
View Full Code Here


        final Namespace namespace = getFeedNamespace();
        final Element catElement = new Element("category", namespace);

        final String term = cat.getTerm();
        if (term != null) {
            final Attribute termAttribute = new Attribute("term", term);
            catElement.setAttribute(termAttribute);
        }

        final String label = cat.getLabel();
        if (label != null) {
            final Attribute labelAttribute = new Attribute("label", label);
            catElement.setAttribute(labelAttribute);
        }

        final String scheme = cat.getScheme();
        if (scheme != null) {
            final Attribute schemeAttribute = new Attribute("scheme", scheme);
            catElement.setAttribute(schemeAttribute);
        }

        return catElement;
View Full Code Here

        final Namespace namespace = getFeedNamespace();
        final Element linkElement = new Element("link", namespace);

        final String rel = link.getRel();
        if (rel != null) {
            final Attribute relAttribute = new Attribute("rel", rel);
            linkElement.setAttribute(relAttribute);
        }

        final String type = link.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            linkElement.setAttribute(typeAttribute);
        }

        final String href = link.getHref();
        if (href != null) {
            final Attribute hrefAttribute = new Attribute("href", href);
            linkElement.setAttribute(hrefAttribute);
        }

        final String hreflang = link.getHreflang();
        if (hreflang != null) {
            final Attribute hreflangAttribute = new Attribute("hreflang", hreflang);
            linkElement.setAttribute(hreflangAttribute);
        }

        final String linkTitle = link.getTitle();
        if (linkTitle != null) {
            final Attribute title = new Attribute("title", linkTitle);
            linkElement.setAttribute(title);
        }

        if (link.getLength() != 0) {
            final Attribute lenght = new Attribute("length", Long.toString(link.getLength()));
            linkElement.setAttribute(lenght);
        }

        return linkElement;
View Full Code Here

        final Element taglineElement = new Element("subtitle", getFeedNamespace());

        final String type = tagline.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            taglineElement.setAttribute(typeAttribute);
        }

        final String value = tagline.getValue();
        if (value != null) {
View Full Code Here

                atomType = Content.HTML;
            } else if ("application/xhtml+xml".equals(type)) {
                atomType = Content.XHTML;
            }

            final Attribute typeAttribute = new Attribute("type", atomType);
            contentElement.setAttribute(typeAttribute);
        }

        final String href = content.getSrc();
        if (href != null) {
            final Attribute srcAttribute = new Attribute("src", href);
            contentElement.setAttribute(srcAttribute);
        }

        final String value = content.getValue();
        if (value != null) {
View Full Code Here

        final Element generatorElement = new Element("generator", getFeedNamespace());

        final String url = generator.getUrl();
        if (url != null) {
            final Attribute urlAttribute = new Attribute("uri", url);
            generatorElement.setAttribute(urlAttribute);
        }

        final String version2 = generator.getVersion();
        if (version2 != null) {
            final Attribute versionAttribute = new Attribute("version", version2);
            generatorElement.setAttribute(versionAttribute);
        }

        final String value = generator.getValue();
        if (value != null) {
View Full Code Here

    }

    protected Element createRootElement(final Feed feed) {
        final Element root = new Element("feed", getFeedNamespace());
        root.addNamespaceDeclaration(getFeedNamespace());
        final Attribute version = new Attribute("version", getVersion());
        root.setAttribute(version);
        generateModuleNamespaceDefs(root);
        return root;
    }
View Full Code Here

        final Element linkElement = new Element("link", getFeedNamespace());

        final String rel = link.getRel();
        if (rel != null) {
            final Attribute relAttribute = new Attribute("rel", rel.toString());
            linkElement.setAttribute(relAttribute);
        }

        final String type = link.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            linkElement.setAttribute(typeAttribute);
        }

        final String href = link.getHref();
        if (href != null) {
            final Attribute hrefAttribute = new Attribute("href", href);
            linkElement.setAttribute(hrefAttribute);
        }

        return linkElement;
View Full Code Here

        final Element taglineElement = new Element("tagline", getFeedNamespace());

        final String type = tagline.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            taglineElement.setAttribute(typeAttribute);
        }

        final String value = tagline.getValue();
        if (value != null) {
View Full Code Here

    protected void fillContentElement(final Element contentElement, final Content content) throws FeedException {

        final String type = content.getType();
        if (type != null) {
            final Attribute typeAttribute = new Attribute("type", type);
            contentElement.setAttribute(typeAttribute);
        }

        final String mode = content.getMode();
        if (mode != null) {
            final Attribute modeAttribute = new Attribute("mode", mode.toString());
            contentElement.setAttribute(modeAttribute);
        }

        final String value = content.getValue();
        if (value != null) {
View Full Code Here

TOP

Related Classes of org.jdom2.Attribute

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.