本文整理匯總了Java中org.codehaus.plexus.util.xml.Xpp3Dom.removeChild方法的典型用法代碼示例。如果您正苦於以下問題:Java Xpp3Dom.removeChild方法的具體用法?Java Xpp3Dom.removeChild怎麽用?Java Xpp3Dom.removeChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.plexus.util.xml.Xpp3Dom
的用法示例。
在下文中一共展示了Xpp3Dom.removeChild方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: NarTestCompileBuildParticipant
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
public NarTestCompileBuildParticipant(MojoExecution execution, boolean runOnIncremental, boolean runOnConfiguration) {
super(new MojoExecution(execution.getMojoDescriptor(), execution.getExecutionId(), execution.getSource()), runOnIncremental, runOnConfiguration);
// Some versions of nar-maven-plugin don't have a nar-test-unpack goal
// this means the test artifacts won't be available to us.
// What we need to do is run the nar-testCompile goal without any tests
// its configuration in order to just unpack.
Xpp3Dom configuration = new Xpp3Dom(execution.getConfiguration());
logger.debug("Configuration before: " + configuration);
for (int i = 0; i < configuration.getChildCount(); ++i) {
if ("tests".equals(configuration.getChild(i).getName())) {
configuration.removeChild(i);
break;
}
}
logger.debug("Configuration after: " + configuration);
getMojoExecution().setConfiguration(configuration);
}
示例2: extractEligibleConfigurationForGoal
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
* Extracts the subset of the given configuration containing only the values accepted by the plugin/goal. The
* configuration is modified in-place. The the extraction fail the configuration stays unchanged.
*
* @param mojo the Wisdom mojo
* @param plugin the plugin object
* @param goal the goal / mojo
* @param configuration the global configuration
*/
public static void extractEligibleConfigurationForGoal(AbstractWisdomMojo mojo,
Plugin plugin, String goal, Xpp3Dom configuration) {
try {
MojoDescriptor descriptor = mojo.pluginManager.getMojoDescriptor(plugin, goal,
mojo.remoteRepos, mojo.repoSession);
final List<Parameter> parameters = descriptor.getParameters();
Xpp3Dom[] children = configuration.getChildren();
if (children != null) {
for (int i = children.length - 1; i >= 0; i--) {
Xpp3Dom child = children[i];
if (!contains(parameters, child.getName())) {
configuration.removeChild(i);
}
}
}
} catch (Exception e) {
mojo.getLog().warn("Cannot extract the eligible configuration for goal " + goal + " from the " +
"configuration");
mojo.getLog().debug(e);
// The configuration is not changed.
}
}
示例3: createFullIdeModuleWithExcludes
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/** Creates copy of the Full.gwt.xml with removed '<inherits>' for the excluded GWT modules. */
private void createFullIdeModuleWithExcludes(Set<String> modulesToExclude)
throws XmlPullParserException, IOException {
String fullIdeGwtModulePath = fullIdeGwtModule.replace('.', '/') + ".gwt.xml";
String fullIdeGwtModuleContent =
getFileContent(new ZipFile(fullIdeArtifact.getFile()), fullIdeGwtModulePath);
InputStream in = new ByteArrayInputStream(fullIdeGwtModuleContent.getBytes(UTF_8.name()));
Xpp3Dom module = Xpp3DomBuilder.build(in, 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 (modulesToExclude.contains(moduleName)) {
module.removeChild(i);
}
}
}
String moduleRelPath =
fullIdeGwtModulePath.replace(".gwt.xml", FULL_IDE_GWT_MODULE_SUFFIX + ".gwt.xml");
Path modulePath = Paths.get(outputDirectory.getPath(), moduleRelPath);
try (Writer writer = new StringWriter()) {
XMLWriter xmlWriter = new PrettyPrintXMLWriter(writer);
Xpp3DomWriter.write(xmlWriter, module);
Files.write(modulePath, writer.toString().getBytes());
}
}
示例4: removeXpp3Node
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
public static boolean removeXpp3Node(Xpp3Dom parent,Xpp3Dom child) {
int removeIndex=-1;
for(int i=0;i<parent.getChildCount();i++){
if (parent.getChild(i)==child){
removeIndex=i;
break;
}
}
if (removeIndex==-1){
return false;
}else{
parent.removeChild(removeIndex);
return true;
}
}
示例5: removeChildren
import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private void removeChildren(Xpp3Dom parent) {
while (parent.getChildCount() != 0)
parent.removeChild(0);
}