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


Java Element.setAttribute方法代码示例

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


在下文中一共展示了Element.setAttribute方法的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: getState

import org.jdom.Element; //导入方法依赖的package包/类
@Nullable
@Override
public Element getState() {
    final Element element = new Element(KEY.ROOT.toString());
    element.setAttribute(KEY.VERSION.toString(), version);

    return element;
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:9,代码来源:TYPO3CMSSettings.java

示例3: getState

import org.jdom.Element; //导入方法依赖的package包/类
@Nullable
@Override
public Element getState() {
    synchronized (lock) {
        final Element element = new Element("state");

        for (Entity entity : queue) {
            final Element entityElement = new Element(TAG_ENTITY);
            entityElement.setAttribute(ATTR_ACTION, entity.getAction().name());
            entityElement.setAttribute(ATTR_DATE, entity.getDateStr());
            final String parameters = entity.getParameters();

            if (parameters != null) {
                entityElement.setAttribute(ATTR_NAME, parameters);
            }
            element.addContent(entityElement);
        }
        return element;
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:DefaultStatsCollector.java

示例4: loadStateShouldLoadFromElement

import org.jdom.Element; //导入方法依赖的package包/类
@Test
public void loadStateShouldLoadFromElement() throws Exception {
    // setup
    final Element state = new Element("component");
    state.setAttribute("style", "JACKSON");
    state.setAttribute("classNamePrefix", "Foo");
    state.setAttribute("classNameSuffix", "Baz");
    state.setAttribute("annotationGenerated", "true");
    state.setAttribute("annotationSuppressWarnings", "false");

    // exercise
    underTest.loadState(state);

    // verify
    final Element actual = underTest.getState();
    assertThat(actual)
            .isNotNull()
            .hasName("component")
            .hasAttribute("style", "JACKSON")
            .hasAttribute("classNamePrefix", "Foo")
            .hasAttribute("classNameSuffix", "Baz")
            .hasAttribute("annotationGenerated", "true")
            .hasAttribute("annotationSuppressWarnings", "false");
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:25,代码来源:PersistentJson2JavaSettingsTest.java

示例5: generateCloud

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

示例6: 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

示例7: write

import org.jdom.Element; //导入方法依赖的package包/类
public static void write( Writer w, Model newModel, boolean namespaceDeclaration )
    throws IOException
{
    Element root = new Element( "project" );

    if ( namespaceDeclaration )
    {
        String modelVersion = newModel.getModelVersion();

        Namespace pomNamespace = Namespace.getNamespace( "", "http://maven.apache.org/POM/" + modelVersion );

        root.setNamespace( pomNamespace );

        Namespace xsiNamespace = Namespace.getNamespace( "xsi", "http://www.w3.org/2001/XMLSchema-instance" );

        root.addNamespaceDeclaration( xsiNamespace );

        if ( root.getAttribute( "schemaLocation", xsiNamespace ) == null )
        {
            root.setAttribute( "schemaLocation",
                               "http://maven.apache.org/POM/" + modelVersion + " http://maven.apache.org/maven-v"
                                   + modelVersion.replace( '.', '_' ) + ".xsd", xsiNamespace );
        }
    }

    Document doc = new Document( root );

    MavenJDOMWriter writer = new MavenJDOMWriter();

    String encoding = newModel.getModelEncoding() != null ? newModel.getModelEncoding() : "UTF-8";

    Format format = Format.getPrettyFormat().setEncoding( encoding );

    writer.write( newModel, doc, w, format );
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:36,代码来源:PomWriter.java

示例8: 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

示例9: getInfoUrlAsElement

import org.jdom.Element; //导入方法依赖的package包/类
public Element getInfoUrlAsElement(){
	/*
		<info url="http://acme.com/" text="Using MsTeamsNotifications in Acme Inc." />
	 */
	if (this.msteamsnotificationInfoUrl != null && this.msteamsnotificationInfoUrl.length() > 0){
		Element e = new Element("info");
		e.setAttribute("url", msteamsnotificationInfoUrl);
		if (this.msteamsnotificationInfoText != null && this.msteamsnotificationInfoText.length() > 0){
			e.setAttribute("text", msteamsnotificationInfoText);
		} else {
			e.setAttribute("text", msteamsnotificationInfoUrl);
		}
		e.setAttribute("show-reading", msteamsnotificationShowFurtherReading.toString());
		
		return e;
	}
	return null;
}
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:19,代码来源:MsTeamsNotificationMainConfig.java

示例10: getProxyAsElement

import org.jdom.Element; //导入方法依赖的package包/类
public Element getProxyAsElement(){
	/*
   		  <proxy host="myproxy.mycompany.com" port="8080" >
     			<noproxy url=".mycompany.com" />
     			<noproxy url="192.168.0." />
   		  </proxy>
	 */
	if (this.getProxyHost() == null || this.getProxyPort() == null){
		return null;
	}
	Element el = new Element(PROXY);
	el.setAttribute("host", this.getProxyHost());
	el.setAttribute("port", String.valueOf(this.getProxyPort()));
	if (   this.proxyPassword != null && this.proxyPassword.length() > 0 
		&& this.proxyUsername != null && this.proxyUsername.length() > 0 )
	{
		el.setAttribute(USERNAME, this.getProxyUsername());
		el.setAttribute(PASSWORD, this.getProxyPassword());
		
	}
	return el;
}
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:23,代码来源:MsTeamsNotificationMainConfig.java

示例11: save

import org.jdom.Element; //导入方法依赖的package包/类
public void save(File sav) {
	Document document = new Document();
	Element root = new Element("blocks");
	document.setRootElement(root);
	for (int x = 0; x < BLOCKS_WIDTH; x++) {
		for (int y = 0; y < BLOCKS_HEIGHT; y++) {
			Element block = new Element("block");
			block.setAttribute("x", String.valueOf((int) (blocks[x][y].getX() / BLOCK_SIZE)));
			block.setAttribute("y", String.valueOf((int) (blocks[x][y].getY() / BLOCK_SIZE)));
			block.setAttribute("type", String.valueOf(blocks[x][y].getType()));
			root.addContent(block);
		}
	}
	XMLOutputter output = new XMLOutputter();
	try {
		output.output(document, new FileOutputStream(sav));
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:21,代码来源:BlockGrid.java

示例12: writeExternal

import org.jdom.Element; //导入方法依赖的package包/类
@Override
public void writeExternal(Element element) throws WriteExternalException {
  super.writeExternal(element);
  if (!StringUtil.isEmpty(scriptPath)) {
    element.setAttribute(SCRIPT_PATH_URL, scriptPath);
  }
  if (!StringUtil.isEmpty(scriptParameters)) {
    element.setAttribute(SCRIPT_PARAMETERS, scriptParameters);
  }
  if (!StringUtil.isEmpty(scriptOptions)) {
    element.setAttribute(SCRIPT_OPTIONS, scriptOptions);
  }
  element.setAttribute(SCRIPT_SHOW_EVENTS, myShowAppleEvents ? "true" : "false");
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:15,代码来源:AppleScriptRunConfiguration.java

示例13: addTextChildMap

import org.jdom.Element; //导入方法依赖的package包/类
public static Element addTextChildMap(Element parent, String name, Map<String, String> value) {
  Element mapElement = new Element(MAP);
  for (Map.Entry<String, String> entry : value.entrySet()) {
    Element entryElement = new Element("entry");
    mapElement.addContent(entryElement);
    String key = entry.getKey();
    entryElement.setAttribute("key", key);
    entryElement.setAttribute("value", entry.getValue());
  }
  return addChildWithName(parent, name, mapElement);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:12,代码来源:StudySerializationUtils.java

示例14: addLibrary

import org.jdom.Element; //导入方法依赖的package包/类
private void addLibrary(Element runtime, String type, String path, String id)
{
	Element lib = new Element("library");
	lib.setAttribute("type", type);
	lib.setAttribute("path", path);
	lib.setAttribute("id", id);
	runtime.addContent(lib);
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:NewJPFPluginWizardPageOne.java

示例15: addEntry

import org.jdom.Element; //导入方法依赖的package包/类
protected void addEntry(Entry entry,Element parent) throws FeedException {
    Element eEntry = new Element("entry", getFeedNamespace());
    if (entry.getXmlBase() != null) {
        eEntry.setAttribute("base", entry.getXmlBase(), Namespace.XML_NAMESPACE);
    }
    populateEntry(entry,eEntry);
    checkEntryConstraints(eEntry);
    generateItemModules(entry.getModules(),eEntry);
    parent.addContent(eEntry);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:Atom10Generator.java


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