当前位置: 首页>>代码示例>>Java>>正文


Java Attribute类代码示例

本文整理汇总了Java中org.jdom.Attribute的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Attribute类属于org.jdom包,在下文中一共展示了Attribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateGeneratorElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateGeneratorElement(Generator generator) {
    Element generatorElement = new Element("generator", getFeedNamespace());

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

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

    if (generator.getValue() != null) {
        generatorElement.addContent(generator.getValue());
    }

    return generatorElement;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:Atom03Generator.java

示例2: getChildWithName

import org.jdom.Attribute; //导入依赖的package包/类
public static Element getChildWithName(Element parent, String name, boolean optional) throws StudyUnrecognizedFormatException {
  for (Element child : parent.getChildren()) {
    Attribute attribute = child.getAttribute(NAME);
    if (attribute == null) {
      continue;
    }
    if (name.equals(attribute.getValue())) {
      return child;
    }
  }
  if (optional) {
    return null;
  }
  throw new StudyUnrecognizedFormatException();
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:16,代码来源:StudySerializationUtils.java

示例3: createRootElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element createRootElement(Feed feed) {
    Element root = new Element("feed",getFeedNamespace());
    root.addNamespaceDeclaration(getFeedNamespace());
    Attribute version = new Attribute("version", getVersion());
    root.setAttribute(version);
    generateModuleNamespaceDefs(root);
    return root;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:Atom03Generator.java

示例4: generateLinkElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateLinkElement(Link link) {
    Element linkElement = new Element("link", getFeedNamespace());

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

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

    if (link.getHref() != null) {
        Attribute hrefAttribute = new Attribute("href", link.getHref());
        linkElement.setAttribute(hrefAttribute);
    }
    return linkElement;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:Atom03Generator.java

示例5: resolveURI

import org.jdom.Attribute; //导入依赖的package包/类
/** Use xml:base attributes at feed and entry level to resolve relative links */
private String resolveURI(URL baseURI, Parent parent, String url) {
    url = (url.equals(".") || url.equals("./")) ? "" : url;
    if (isRelativeURI(url) && parent != null && parent instanceof Element) {
        Attribute baseAtt = ((Element)parent).getAttribute("base", Namespace.XML_NAMESPACE);
        String xmlBase = (baseAtt == null) ? "" : baseAtt.getValue();
        if (!isRelativeURI(xmlBase) && !xmlBase.endsWith("/")) {
            xmlBase = xmlBase.substring(0, xmlBase.lastIndexOf("/")+1);
        }
        return resolveURI(baseURI, parent.getParent(), xmlBase + url);
    } else if (isRelativeURI(url) && parent == null) {
        return baseURI + url;
    } else if (baseURI != null && url.startsWith("/")) {
        String hostURI = baseURI.getProtocol() + "://" + baseURI.getHost();
        if (baseURI.getPort() != baseURI.getDefaultPort()) {
            hostURI = hostURI + ":" + baseURI.getPort();
        }
        return hostURI + url;
    }
    return url;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:Atom10Parser.java

示例6: generateSubjectElement

import org.jdom.Attribute; //导入依赖的package包/类
/**
 * Utility method to generate an element for a subject.
 * <p>
 * @param subject the subject to generate an element for.
 * @return the element for the subject.
 */
protected final Element generateSubjectElement(DCSubject subject) {
    Element subjectElement = new Element("subject", getDCNamespace());

    if (subject.getTaxonomyUri() != null) {
        Element descriptionElement = new Element("Description", getRDFNamespace());
        Element topicElement = new Element("topic", getTaxonomyNamespace());
        Attribute resourceAttribute = new Attribute("resource", subject.getTaxonomyUri(), getRDFNamespace());
        topicElement.setAttribute(resourceAttribute);
        descriptionElement.addContent(topicElement);

        if (subject.getValue() != null) {
            Element valueElement = new Element("value", getRDFNamespace());
            valueElement.addContent(subject.getValue());
            descriptionElement.addContent(valueElement);
        }
        subjectElement.addContent(descriptionElement);
    } else {
        subjectElement.addContent(subject.getValue());
    }
    return subjectElement;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:DCModuleGenerator.java

示例7: isMyType

import org.jdom.Attribute; //导入依赖的package包/类
public boolean isMyType(Document document) {
    boolean ok = false;
    Element rssRoot = document.getRootElement();
    ok = rssRoot.getName().equals("rss");
    if (ok) {
        ok = false;
        Attribute version = rssRoot.getAttribute("version");
        if (version!=null) {
            ok = version.getValue().equals(getRSSVersion());
        }
    }
    return ok;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:RSS091UserlandParser.java

示例8: generateCategoryElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateCategoryElement(Category cat) {
    Element catElement = new Element("category", getFeedNamespace());

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

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

    if (cat.getScheme() != null) {
        Attribute schemeAttribute = new Attribute("scheme", cat.getScheme());
        catElement.setAttribute(schemeAttribute);
    }
    return catElement;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:Atom10Generator.java

示例9: generateLinkElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateLinkElement(Link link) {
    Element linkElement = new Element("link", getFeedNamespace());

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

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

    if (link.getHref() != null) {
        Attribute hrefAttribute = new Attribute("href", link.getHref());
        linkElement.setAttribute(hrefAttribute);
    }
    
    if (link.getHreflang() != null) {
        Attribute hreflangAttribute = new Attribute("hreflang", link.getHreflang());
        linkElement.setAttribute(hreflangAttribute);
    }
    return linkElement;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:Atom10Generator.java

示例10: generateTagLineElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateTagLineElement(Content tagline) {
    Element taglineElement = new Element("subtitle", getFeedNamespace());

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

    if (tagline.getValue() != null) {
        taglineElement.addContent(tagline.getValue());
    }
    return taglineElement;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:Atom10Generator.java

示例11: generateGeneratorElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateGeneratorElement(Generator generator) {
    Element generatorElement = new Element("generator", getFeedNamespace());

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

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

    if (generator.getValue() != null) {
        generatorElement.addContent(generator.getValue());
    }

    return generatorElement;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:Atom10Generator.java

示例12: populateItem

import org.jdom.Attribute; //导入依赖的package包/类
protected void populateItem(Item item, Element eItem, int index) {
    super.populateItem(item,eItem, index);

    Description description = item.getDescription();
    if (description!=null && description.getType()!=null) {
        Element eDescription = eItem.getChild("description",getFeedNamespace());
        eDescription.setAttribute(new Attribute("type",description.getType()));
    }
    eItem.removeChild("expirationDate",getFeedNamespace());
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:RSS094Generator.java

示例13: generateCloud

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateCloud(Cloud cloud) {
    Element eCloud = new Element("cloud",getFeedNamespace());

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

    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;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:RSS092Generator.java

示例14: generateSourceElement

import org.jdom.Attribute; //导入依赖的package包/类
protected Element generateSourceElement(Source source) {
    Element sourceElement = new Element("source",getFeedNamespace());
    if (source.getUrl() != null) {
        sourceElement.setAttribute(new Attribute("url", source.getUrl()));
    }
    sourceElement.addContent(source.getValue());
    return sourceElement;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:RSS092Generator.java

示例15: getTaxonomy

import org.jdom.Attribute; //导入依赖的package包/类
/**
 * Utility method to parse a taxonomy from an element.
 * <p>
 * @param desc the taxonomy description element.
 * @return the string contained in the resource of the element.
 */
protected final String getTaxonomy(Element desc) {
    String d = null;
    Element taxo = desc.getChild("topic", getTaxonomyNamespace());
    if (taxo!=null) {
        Attribute a = taxo.getAttribute("resource", getRDFNamespace());
        if (a!=null) {
            d = a.getValue();
        }
    }
    return d;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:DCModuleParser.java


注:本文中的org.jdom.Attribute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。