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


Java Xpp3Dom.setAttribute方法代码示例

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


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

示例1: newElement

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
public Xpp3Dom newElement(@Nonnull String name, @Nullable Throwable t) {
    Xpp3Dom rootElt = new Xpp3Dom(name);
    if (t == null) {
        return rootElt;
    }
    rootElt.setAttribute("class", t.getClass().getName());

    Xpp3Dom messageElt = new Xpp3Dom("message");
    rootElt.addChild(messageElt);
    messageElt.setValue(t.getMessage());

    Xpp3Dom stackTraceElt = new Xpp3Dom("stackTrace");
    rootElt.addChild(stackTraceElt);
    StringWriter stackTrace = new StringWriter();
    t.printStackTrace(new PrintWriter(stackTrace, true));
    messageElt.setValue(stackTrace.toString());
    return rootElt;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:19,代码来源:AbstractMavenEventHandler.java

示例2: addDetails

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@Override
protected void addDetails(@Nonnull ExecutionEvent executionEvent, @Nonnull Xpp3Dom root) {
    super.addDetails(executionEvent, root);
    MavenProject parentProject = executionEvent.getProject().getParent();
    if (parentProject == null) {
        // nothing to do
    } else {
        Xpp3Dom parentProjectElt = new Xpp3Dom("parentProject");
        root.addChild(parentProjectElt);
        parentProjectElt.setAttribute("name", parentProject.getName());
        parentProjectElt.setAttribute("groupId", parentProject.getGroupId());

        parentProjectElt.setAttribute("artifactId", parentProject.getArtifactId());
        parentProjectElt.setAttribute("version", parentProject.getVersion());
    }
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:17,代码来源:ProjectStartedExecutionHandler.java

示例3: _handle

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@Override
protected boolean _handle(MavenExecutionResult result) {
    Xpp3Dom root = new Xpp3Dom("MavenExecutionResult");
    root.setAttribute("class", result.getClass().getName());

    for (MavenProject project : result.getTopologicallySortedProjects()) {
        BuildSummary summary = result.getBuildSummary(project);
        if (summary == null) {
            Xpp3Dom comment = new Xpp3Dom("comment");
            comment.setValue("No build summary found for maven project: " + project);
            root.addChild(comment);
        } else {
            Xpp3Dom buildSummary = newElement("buildSummary", project);
            root.addChild(buildSummary);
            buildSummary.setAttribute("class", summary.getClass().getName());
            buildSummary.setAttribute("time", Long.toString(summary.getTime()));
        }
    }
    for(Throwable throwable: result.getExceptions()) {
        root.addChild(newElement("exception", throwable));
    }
    reporter.print(root);
    return true;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:25,代码来源:MavenExecutionResultHandler.java

示例4: patchGwtModule

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
/**
 * Patches the IDE GWT module by replacing inheritance of Full.gwt.xml by
 * Full-with-excludes.gwt.xml.
 */
private void patchGwtModule() throws XmlPullParserException, IOException {
  String gwtModuleFileRelPath = getGwtModule().replace('.', '/') + ".gwt.xml";
  Path gwtModuleFilePath = Paths.get(outputDirectory.getPath(), gwtModuleFileRelPath);

  Xpp3Dom module = Xpp3DomBuilder.build(Files.newInputStream(gwtModuleFilePath), UTF_8.name());

  for (int i = module.getChildCount() - 1; i >= 0; i--) {
    Xpp3Dom child = module.getChild(i);

    if ("inherits".equals(child.getName())) {
      String moduleName = child.getAttribute("name");

      if (moduleName.equals(fullIdeGwtModule)) {
        child.setAttribute("name", fullIdeGwtModule + FULL_IDE_GWT_MODULE_SUFFIX);
        break;
      }
    }
  }

  try (Writer writer = new StringWriter()) {
    XMLWriter xmlWriter = new PrettyPrintXMLWriter(writer);
    Xpp3DomWriter.write(xmlWriter, module);
    Files.write(gwtModuleFilePath, writer.toString().getBytes());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:ProcessExcludesMojo.java

示例5: toXppDom

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
/**
 * Recursively convert PLEXUS config to Xpp3Dom.
 * @param config The config to convert
 * @return The Xpp3Dom document
 * @see #execute(String,String,Properties)
 */
private Xpp3Dom toXppDom(final PlexusConfiguration config) {
    final Xpp3Dom result = new Xpp3Dom(config.getName());
    result.setValue(config.getValue(null));
    for (final String name : config.getAttributeNames()) {
        try {
            result.setAttribute(name, config.getAttribute(name));
        } catch (final PlexusConfigurationException ex) {
            throw new IllegalArgumentException(ex);
        }
    }
    for (final PlexusConfiguration child : config.getChildren()) {
        result.addChild(this.toXppDom(child));
    }
    return result;
}
 
开发者ID:teamed,项目名称:qulice,代码行数:22,代码来源:MojoExecutor.java

示例6: replaceWebappInfo

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceWebappInfo(String projectName, Xpp3Dom projectDOM)
		throws XmlPullParserException {
	// /jpr:project
	// /hash[@n="oracle.jdeveloper.model.J2eeSettings"]
	// /value[@n="j2eeWebAppName" v="maven-generated-webapp"]
	// /value[@n="j2eeWebContextRoot" v="maven-generated-context-root"]
	Xpp3Dom settingsDOM = findNamedChild(projectDOM, "hash",
			"oracle.jdeveloper.model.J2eeSettings");
	Xpp3Dom webappNameDOM = findNamedChild(settingsDOM, "value",
			"j2eeWebAppName");
	Xpp3Dom webappContextDOM = findNamedChild(settingsDOM, "value",
			"j2eeWebContextRoot");

	String contextName = this.project.getProperties().getProperty(
			"webApp.context");

	webappNameDOM.setAttribute("v", projectName);
	if (contextName != null) {
		webappContextDOM.setAttribute("v", contextName);
	} else {
		// update the webapp context root
		webappContextDOM.setAttribute("v", projectName);
	}
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:25,代码来源:JDeveloperMojo.java

示例7: replaceCompiler

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceCompiler(Xpp3Dom projectDOM)
		throws XmlPullParserException {
	// /jpr:project
	// <hash n="oracle.jdeveloper.compiler.OjcConfiguration">
	// <value n="assertionsEnabled" v="true"/>
	// <value n="compiler.name" v="Ojc"/>
	// <list n="copyRes">
	// <string v=".java"/>
	Xpp3Dom configDOM = findNamedChild(projectDOM, "hash",
			"oracle.jdeveloper.compiler.OjcConfiguration");
	Xpp3Dom compilerDOM = findNamedChild(configDOM, "value",
			"compiler.name");
	String compilerValue = "Ojc";

	if ((compiler != null) && "Javac".equalsIgnoreCase(compiler)) {
		compilerValue = "Javac";
	}
	compilerDOM.setAttribute("v", compilerValue);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:20,代码来源:JDeveloperMojo.java

示例8: replaceTechnologiesScopes

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceTechnologiesScopes(String projectName,
		Xpp3Dom projectDOM) {
	String[] defaultTechnologies = { "ADF_FACES", "ADFbc", "ADFm", "Ant",
			"HTML", "JAVASCRIPT", "JSF", "JSP", "Java", "JSP", "Maven",
			"XML" };

	Xpp3Dom technologyDOM = findNamedChild(projectDOM, "hash",
			"oracle.ide.model.TechnologyScopeConfiguration");
	Xpp3Dom technologyScopeDOM = findNamedChild(technologyDOM, "list",
			"technologyScope");

	String[] technologies = (this.technologiesScope != null && this.technologiesScope.length > 0) ? this.technologiesScope
			: defaultTechnologies;

	for (String techonology : technologies) {
		Xpp3Dom scopeDOM = new Xpp3Dom("string");
		scopeDOM.setAttribute("v", techonology);
		technologyScopeDOM.addChild(scopeDOM);
	}
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:21,代码来源:JDeveloperMojo.java

示例9: replaceOutputDirectory

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private void replaceOutputDirectory(File projectDir, File outputDir,
		Xpp3Dom projectDOM) throws XmlPullParserException {
	// /jpr:project
	// /hash[@n="oracle.jdevimpl.config.JProjectPaths"]

	Xpp3Dom projectPathsDOM = findNamedChild(projectDOM, "hash",
			"oracle.jdevimpl.config.JProjectPaths");
	Xpp3Dom sourceDOM = new Xpp3Dom("url");

	//
	// <url @n="outputDirectory" path="[relative-path-to-output-dir]" />
	//
	sourceDOM.setAttribute("path", getRelativeDir(projectDir, outputDir));
	sourceDOM.setAttribute("n", "outputDirectory");
	projectPathsDOM.addChild(sourceDOM);
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:17,代码来源:JDeveloperMojo.java

示例10: createProjectReferenceDOM

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private Xpp3Dom createProjectReferenceDOM(File workspaceDir,
		File projectFile) {
	Xpp3Dom hashDOM = new Xpp3Dom("hash");
	Xpp3Dom urlDOM = new Xpp3Dom("url");
	urlDOM.setAttribute("n", "URL");
	urlDOM.setAttribute("path", getRelativeFile(workspaceDir, projectFile));

	if (_releaseMajor < 11) {
		Xpp3Dom valueDOM = new Xpp3Dom("value");
		valueDOM.setAttribute("n", "nodeClass");
		valueDOM.setAttribute("v", "oracle.jdeveloper.model.JProject");
		hashDOM.addChild(valueDOM);
	}
	hashDOM.addChild(urlDOM);
	return hashDOM;
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:17,代码来源:JDeveloperMojo.java

示例11: setAttribute

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private static void setAttribute( Xpp3Dom dom, String attribute, String value )
{
    String attr = dom.getAttribute( attribute );

    if ( attr == null || value == null || value.length() <= 0 )
    {
        return;
    }

    dom.setAttribute( attribute, value );
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:12,代码来源:PluginXmlResourceTransformer.java

示例12: _handle

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@Override
protected boolean _handle(MavenExecutionRequest request) {
    Xpp3Dom root = new Xpp3Dom("MavenExecutionRequest");
    root.setAttribute("class", request.getClass().getName());
    root.addChild(newElement("pom", request.getPom()));
    root.addChild(newElement("globalSettingsFile", request.getGlobalSettingsFile()));
    root.addChild(newElement("userSettingsFile", request.getUserSettingsFile()));
    root.addChild(newElement("baseDirectory", request.getBaseDirectory()));

    reporter.print(root);
    return true;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:13,代码来源:MavenExecutionRequestHandler.java

示例13: _handle

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@Override
public boolean _handle(DefaultSettingsBuildingRequest request) {

    Xpp3Dom root = new Xpp3Dom("DefaultSettingsBuildingRequest");
    root.setAttribute("class", request.getClass().getName());
    root.addChild(newElement("userSettingsFile", request.getUserSettingsFile()));
    root.addChild(newElement("globalSettings", request.getGlobalSettingsFile()));

    reporter.print(root);
    return true;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:12,代码来源:DefaultSettingsBuildingRequestHandler.java

示例14: _handle

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
@Override
protected boolean _handle(DependencyResolutionRequest request) {
    Xpp3Dom root = new Xpp3Dom("DependencyResolutionRequest");
    root.setAttribute("class", request.getClass().getName());
    root.addChild(newElement("project", request.getMavenProject()));

    reporter.print(root);
    return true;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:10,代码来源:DependencyResolutionRequestHandler.java

示例15: convertPlexusConfiguration

import org.codehaus.plexus.util.xml.Xpp3Dom; //导入方法依赖的package包/类
private Xpp3Dom convertPlexusConfiguration(PlexusConfiguration config) {

    Xpp3Dom xpp3DomElement = new Xpp3Dom(config.getName());
    xpp3DomElement.setValue(config.getValue());

    for (String name : config.getAttributeNames()) {
      xpp3DomElement.setAttribute(name, config.getAttribute(name));
    }

    for (PlexusConfiguration child : config.getChildren()) {
      xpp3DomElement.addChild(convertPlexusConfiguration(child));
    }

    return xpp3DomElement;
  }
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-maven-plugin,代码行数:16,代码来源:AppengineEnhancerMojo.java


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