Package org.jdom2

Examples of org.jdom2.Attribute


        super.populateItem(item, eItem, index);

        final Description description = item.getDescription();
        if (description != null && description.getType() != null) {
            final Element eDescription = eItem.getChild("description", getFeedNamespace());
            eDescription.setAttribute(new Attribute("type", description.getType()));
        }
        eItem.removeChild("expirationDate", getFeedNamespace());
    }
View Full Code Here


        final String taxonomyUri = subject.getTaxonomyUri();
        final String value = subject.getValue();

        if (taxonomyUri != null) {

            final Attribute resourceAttribute = new Attribute("resource", taxonomyUri, getRDFNamespace());

            final Element topicElement = new Element("topic", getTaxonomyNamespace());
            topicElement.setAttribute(resourceAttribute);

            final Element descriptionElement = new Element("Description", getRDFNamespace());
View Full Code Here

    @Override
    public boolean isMyType(final Document document) {

        final Element rssRoot = document.getRootElement();
        final String name = rssRoot.getName();
        final Attribute version = rssRoot.getAttribute("version");
        final DocType docType = document.getDocType();

        return name.equals(ELEMENT_NAME) && version != null && version.getValue().equals(getRSSVersion()) && docType != null
                && ELEMENT_NAME.equals(docType.getElementName()) && PUBLIC_ID.equals(docType.getPublicID()) && SYSTEM_ID.equals(docType.getSystemID());

    }
View Full Code Here

    }

    @Override
    public boolean isMyType(final Document document) {
        final Element rssRoot = document.getRootElement();
        final Attribute version = rssRoot.getAttribute("version");
        // as far ROME is concerned RSS 2.0, 2.00 and 2.0.X are all the same, so let's use
        // startsWith for leniency.
        return rssRoot.getName().equals("rss") && version != null && version.getValue().startsWith(getRSSVersion());
    }
View Full Code Here

    }

    @Override
    public boolean isMyType(final Document document) {
        final Element rssRoot = document.getRootElement();
        final Attribute version = rssRoot.getAttribute("version");
        return rssRoot.getName().equals("rss") && version != null && version.getValue().equals(getRSSVersion());
    }
View Full Code Here

        final Element eCloud = new Element("cloud", getFeedNamespace());

        final String domain = cloud.getDomain();
        if (domain != null) {
            eCloud.setAttribute(new Attribute("domain", domain));
        }

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

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

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

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

        return eCloud;

    }
View Full Code Here

        final Element sourceElement = new Element("source", getFeedNamespace());

        final String url = source.getUrl();
        if (url != null) {
            sourceElement.setAttribute(new Attribute("url", url));
        }

        sourceElement.addContent(source.getValue());

        return sourceElement;
View Full Code Here

        String ret = null;
        final List<Element> linksList = parent.getChildren("link", ATOM_10_NS);
        if (linksList != null) {
            for (final Element element : linksList) {
                final Element link = element;
                final Attribute relAtt = getAttribute(link, "rel");
                final Attribute hrefAtt = getAttribute(link, "href");
                if (relAtt == null && "alternate".equals(rel) || relAtt != null && relAtt.getValue().equals(rel)) {
                    ret = hrefAtt.getValue();
                    break;
                }
            }
        }
        return ret;
View Full Code Here

    }

    @Override
    protected Element createRootElement(final Channel channel) {
        final Element root = new Element("rss", getFeedNamespace());
        final Attribute version = new Attribute("version", getVersion());
        root.setAttribute(version);
        root.addNamespaceDeclaration(getContentNamespace());
        generateModuleNamespaceDefs(root);
        return root;
    }
View Full Code Here

        return foreignElements;

    }

    protected Attribute getAttribute(final Element e, final String attributeName) {
        Attribute attribute = e.getAttribute(attributeName);
        if (attribute == null) {
            attribute = e.getAttribute(attributeName, namespace);
        }
        return attribute;
    }
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.