本文整理匯總了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;
}
示例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());
}
}
示例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;
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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 );
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}