當前位置: 首頁>>代碼示例>>Java>>正文


Java Element.addContent方法代碼示例

本文整理匯總了Java中org.jdom.Element.addContent方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.addContent方法的具體用法?Java Element.addContent怎麽用?Java Element.addContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdom.Element的用法示例。


在下文中一共展示了Element.addContent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateGeneratorElement

import org.jdom.Element; //導入方法依賴的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: populateItem

import org.jdom.Element; //導入方法依賴的package包/類
protected void populateItem(Item item, Element eItem, int index) {
    super.populateItem(item,eItem, index);
    String link = item.getLink();
    String uri = item.getUri();
    
    if (uri != null) {
        eItem.setAttribute("about", uri, getRDFNamespace());
    } else if (link != null) {
        eItem.setAttribute("about", link, getRDFNamespace());
    }
    
    Description description = item.getDescription();
    if (description!=null) {
        eItem.addContent(generateSimpleElement("description",description.getValue()));
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:17,代碼來源:RSS10Generator.java

示例3: writeTo

import org.jdom.Element; //導入方法依賴的package包/類
@Override
public void writeTo(Element parentElement)
/* Is passed an (probably empty) Element by TC, which is expected to be populated from the settings
 * in memory. 
 */
{
	Loggers.SERVER.debug(NAME + ":writeTo :: " + parentElement.toString());
	parentElement.setAttribute(ENABLED, String.valueOf(this.msTeamsNotificationsEnabled));
    if(msteamsNotificationsConfigs != null)
    {
        for(MsTeamsNotificationConfig whc : msteamsNotificationsConfigs){
        	Element el = whc.getAsElement();
        	Loggers.SERVER.debug(el.toString());
            parentElement.addContent(el);
Loggers.SERVER.debug(NAME + ":writeTo :: enabled " + String.valueOf(whc.getEnabled()));
        }
    }
}
 
開發者ID:spyder007,項目名稱:teamcity-msteams-notifier,代碼行數:19,代碼來源:MsTeamsNotificationProjectSettings.java

示例4: getCorners

import org.jdom.Element; //導入方法依賴的package包/類
public static Element getCorners(GeoImageReader gir) throws GeoTransformException {
    Element gcps = new Element("gcps");
    double[] topLeft = gir.getGeoTransform().getGeoFromPixel(0, 0);
    double[] topRight = gir.getGeoTransform().getGeoFromPixel(gir.getWidth(), 0);
    double[] bottomLeft = gir.getGeoTransform().getGeoFromPixel(0, gir.getHeight());
    double[] bottomRight = gir.getGeoTransform().getGeoFromPixel(gir.getWidth(), gir.getHeight());
    gcps.addContent(createGcp(topLeft[0], topLeft[1], 0, 0));
    gcps.addContent(createGcp(topRight[0], topRight[1], gir.getWidth(), 0));
    gcps.addContent(createGcp(bottomLeft[0], bottomLeft[1], 0, gir.getHeight()));
    gcps.addContent(createGcp(bottomRight[0], bottomRight[1], gir.getWidth(), gir.getHeight()));
    return gcps;
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:13,代碼來源:SumoXmlIOOld.java

示例5: addChildMap

import org.jdom.Element; //導入方法依賴的package包/類
public static Element addChildMap(Element parent, String name, Map<String, Element> value) {
  Element mapElement = new Element(MAP);
  for (Map.Entry<String, Element> entry : value.entrySet()) {
    Element entryElement = new Element("entry");
    mapElement.addContent(entryElement);
    String key = entry.getKey();
    entryElement.setAttribute("key", key);
    Element valueElement = new Element("value");
    valueElement.addContent(entry.getValue());
    entryElement.addContent(valueElement);
  }
  return addChildWithName(parent, name, mapElement);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:14,代碼來源:StudySerializationUtils.java

示例6: addChildWithName

import org.jdom.Element; //導入方法依賴的package包/類
public static Element addChildWithName(Element parent, String name, Object value) {
  Element child = new Element(OPTION);
  child.setAttribute(NAME, name);
  child.setAttribute(VALUE, value.toString());
  parent.addContent(child);
  return child;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:8,代碼來源:StudySerializationUtils.java

示例7: addChildList

import org.jdom.Element; //導入方法依賴的package包/類
public static Element addChildList(Element parent, String name, List<Element> elements) {
  Element listElement = new Element(LIST);
  for (Element element : elements) {
    listElement.addContent(element);
  }
  return addChildWithName(parent, name, listElement);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:8,代碼來源:StudySerializationUtils.java

示例8: fillPersonElement

import org.jdom.Element; //導入方法依賴的package包/類
protected void fillPersonElement(Element element, Person person) {
    if (person.getName() != null) {
        element.addContent(generateSimpleElement("name", person.getName()));
    }
    if (person.getUrl() != null) {
        element.addContent(generateSimpleElement("url", person.getUrl()));
    }

    if (person.getEmail() != null) {
        element.addContent(generateSimpleElement("email", person.getEmail()));
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:13,代碼來源:Atom03Generator.java

示例9: getCreoleXML

import org.jdom.Element; //導入方法依賴的package包/類
@Override
public Document getCreoleXML() throws Exception, JDOMException {
  Document doc = new Document();
  Element element = null;
  doc.addContent(element = new Element("CREOLE-DIRECTORY"));

  element.addContent(element = new Element("CREOLE"));
  element.addContent(element = new Element("RESOURCE"));
  Element classElement = new Element("CLASS");
  classElement.setText(TestResource.class.getName());
  element.addContent(classElement);
  return doc;
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:14,代碼來源:TestResourceReference.java

示例10: generateTagLineElement

import org.jdom.Element; //導入方法依賴的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: writePluginJpf

import org.jdom.Element; //導入方法依賴的package包/類
@SuppressWarnings("nls")
private void writePluginJpf(IProgressMonitor monitor, IProject project) throws CoreException
{
	Document doc = new Document();
	doc.setDocType(new DocType("plugin", "-//JPF//Java Plug-in Manifest 1.0",
		"http://jpf.sourceforge.net/plugin_1_0.dtd"));
	Element rootElem = new Element("plugin");
	doc.setRootElement(rootElem);
	rootElem.setAttribute("id", project.getName());
	rootElem.setAttribute("version", "1");
	Element requires = new Element("requires");
	rootElem.addContent(requires);
	Element runtime = new Element("runtime");
	Element srcLib = new Element("library");
	srcLib.setAttribute("type", "code");
	srcLib.setAttribute("path", "classes/");
	srcLib.setAttribute("id", "classes");
	Element export = new Element("export");
	export.setAttribute("prefix", "*");
	srcLib.addContent(export);
	runtime.addContent(srcLib);
	rootElem.addContent(runtime);
	fFirstPage.customizeManifest(rootElem, project, monitor);
	if( requires.getContentSize() == 0 )
	{
		rootElem.removeContent(requires);
	}

	IFile manifest = JPFProject.getManifest(project);
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	try
	{
		xmlOut.output(doc, baos);
	}
	catch( IOException e )
	{
		throw new RuntimeException(e);
	}
	manifest.create(new ByteArrayInputStream(baos.toByteArray()), true, monitor);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:41,代碼來源:NewPluginWizard.java

示例12: generateSourceElement

import org.jdom.Element; //導入方法依賴的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

示例13: writeExternal

import org.jdom.Element; //導入方法依賴的package包/類
@Override
public void writeExternal(final Element element) throws WriteExternalException {
    super.writeExternal(element);

    if (this.runFilePath != null) {
        final Element fileElement = new Element("file");
        fileElement.setText(this.runFilePath);
        element.addContent(fileElement);
    }
}
 
開發者ID:ceddy4395,項目名稱:Goal-Intellij-Plugin,代碼行數:11,代碼來源:GoalRunConfiguration.java

示例14: fillContentElement

import org.jdom.Element; //導入方法依賴的package包/類
protected void fillContentElement(Element contentElement, Content content)
    throws FeedException {

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

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

    if (content.getValue() != null) {

        if (mode == null || mode.equals(Content.ESCAPED)) {
            contentElement.addContent(content.getValue());
        } else if (mode.equals(Content.BASE64)) {
            contentElement.addContent(Base64.encode(content.getValue()));
        } else if (mode.equals(Content.XML)) {

            StringBuffer tmpDocString = new StringBuffer("<tmpdoc>");
            tmpDocString.append(content.getValue());
            tmpDocString.append("</tmpdoc>");
            StringReader tmpDocReader = new StringReader(tmpDocString.toString());
            Document tmpDoc;

            try {
                SAXBuilder saxBuilder = new SAXBuilder();
                tmpDoc = saxBuilder.build(tmpDocReader);
            }
            catch (Exception ex) {
                throw new FeedException("Invalid XML",ex);
            }

            List children = tmpDoc.getRootElement().removeContent();
            contentElement.addContent(children);
        }
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:42,代碼來源:Atom03Generator.java

示例15: populateFeedHeader

import org.jdom.Element; //導入方法依賴的package包/類
protected void populateFeedHeader(Feed feed, Element eFeed) throws FeedException {
    if (feed.getTitle() != null) {
        eFeed.addContent(generateSimpleElement("title", feed.getTitle()));
    }

    List links = feed.getAlternateLinks();
    for (int i = 0; i < links.size(); i++) {
        eFeed.addContent(generateLinkElement((Link)links.get(i)));
    }

    links = feed.getOtherLinks();
    for (int i = 0; i < links.size(); i++) {
        eFeed.addContent(generateLinkElement((Link)links.get(i)));
    }
    if (feed.getAuthors()!=null && feed.getAuthors().size() > 0) {
        Element authorElement = new Element("author", getFeedNamespace());
        fillPersonElement(authorElement, (Person)feed.getAuthors().get(0));
        eFeed.addContent(authorElement);
    }

    List contributors = feed.getContributors();
    for (int i = 0; i < contributors.size(); i++) {
        Element contributorElement = new Element("contributor", getFeedNamespace());
        fillPersonElement(contributorElement, (Person)contributors.get(i));
        eFeed.addContent(contributorElement);
    }

    if (feed.getTagline() != null) {
        Element taglineElement = new Element("tagline", getFeedNamespace());
        fillContentElement(taglineElement, feed.getTagline());
        eFeed.addContent(taglineElement);
    }

    if (feed.getId() != null) {
        eFeed.addContent(generateSimpleElement("id", feed.getId()));
    }

    if (feed.getGenerator() != null) {
        eFeed.addContent(generateGeneratorElement(feed.getGenerator()));
    }

    if (feed.getCopyright() != null) {
        eFeed.addContent(generateSimpleElement("copyright", feed.getCopyright()));
    }

    if (feed.getInfo() != null) {
        Element infoElement = new Element("info", getFeedNamespace());
        fillContentElement(infoElement, feed.getInfo());
        eFeed.addContent(infoElement);
    }

    if (feed.getModified() != null) {
        Element modifiedElement = new Element("modified", getFeedNamespace());
        modifiedElement.addContent(DateParser.formatW3CDateTime(feed.getModified()));
        eFeed.addContent(modifiedElement);
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:58,代碼來源:Atom03Generator.java


注:本文中的org.jdom.Element.addContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。