本文整理汇总了Java中io.fabric8.utils.DomHelper.addChildElement方法的典型用法代码示例。如果您正苦于以下问题:Java DomHelper.addChildElement方法的具体用法?Java DomHelper.addChildElement怎么用?Java DomHelper.addChildElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.fabric8.utils.DomHelper
的用法示例。
在下文中一共展示了DomHelper.addChildElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addModuleNameIfMissing
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected boolean addModuleNameIfMissing(Element modules, String moduleName) {
NodeList childNodes = modules.getChildNodes();
if (childNodes != null) {
for (int i = 0; i < childNodes.getLength(); i++) {
Node item = childNodes.item(i);
if (item instanceof Element) {
Element property = (Element) item;
if (moduleName.equals(property.getTextContent())) {
return false;
}
}
}
}
modules.appendChild(modules.getOwnerDocument().createTextNode("\n "));
DomHelper.addChildElement(modules, "module", moduleName);
return true;
}
示例2: getOrCreateFirstChild
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected Element getOrCreateFirstChild(Element element, String elementName) {
Element answer = DomHelper.firstChild(element, elementName);
if (answer != null) {
return answer;
}
return DomHelper.addChildElement(element, elementName);
}
示例3: ensureMavenDependency
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected static boolean ensureMavenDependency(Document doc, String groupId, String artifactId, String scope) {
Element dependences = DomHelper.firstChild(doc.getDocumentElement(), "dependencies");
if (dependences == null) {
dependences = DomHelper.addChildElement(doc.getDocumentElement(), "dependencies");
}
NodeList childNodes = dependences.getChildNodes();
for (int i = 0, size = childNodes.getLength(); i < size; i++) {
Node item = childNodes.item(i);
if (item instanceof Element) {
Element child = (Element) item;
if (firstChildTextContent(child, "groupId", groupId) &&
firstChildTextContent(child, "artifactId", artifactId)) {
return false;
}
}
}
dependences.appendChild(doc.createTextNode("\n "));
Element dependency = DomHelper.addChildElement(dependences, "dependency");
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "groupId", groupId);
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "artifactId", artifactId);
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "scope", scope);
dependency.appendChild(doc.createTextNode("\n "));
dependences.appendChild(doc.createTextNode("\n "));
return true;
}
示例4: ensureMavenDependencyBOM
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected static boolean ensureMavenDependencyBOM(Document doc, String groupId, String artifactId, String version) {
Element dependencyManagement = DomHelper.firstChild(doc.getDocumentElement(), "dependencyManagement");
if (dependencyManagement == null) {
dependencyManagement = DomHelper.addChildElement(doc.getDocumentElement(), "dependencyManagement");
}
Element dependences = DomHelper.firstChild(dependencyManagement, "dependencies");
if (dependences == null) {
dependences = DomHelper.addChildElement(dependencyManagement, "dependencies");
}
NodeList childNodes = dependences.getChildNodes();
for (int i = 0, size = childNodes.getLength(); i < size; i++) {
Node item = childNodes.item(i);
if (item instanceof Element) {
Element child = (Element) item;
if (firstChildTextContent(child, "groupId", groupId) &&
firstChildTextContent(child, "artifactId", artifactId)) {
return false;
}
}
}
dependences.appendChild(doc.createTextNode("\n "));
Element dependency = DomHelper.addChildElement(dependences, "dependency");
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "groupId", groupId);
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "artifactId", artifactId);
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "version", version);
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "type", "pom");
dependency.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(dependency, "scope", "import");
dependency.appendChild(doc.createTextNode("\n "));
dependences.appendChild(doc.createTextNode("\n "));
return true;
}
示例5: ensureFailsafePlugin
import io.fabric8.utils.DomHelper; //导入方法依赖的package包/类
protected boolean ensureFailsafePlugin(Document doc) {
String artifactId = "maven-failsafe-plugin";
Element build = DomHelper.firstChild(doc.getDocumentElement(), "build");
if (build == null) {
build = DomHelper.addChildElement(doc.getDocumentElement(), "build");
}
Element plugins = DomHelper.firstChild(build, "plugins");
if (plugins == null) {
plugins = DomHelper.addChildElement(build, "plugins");
}
NodeList childNodes = plugins.getChildNodes();
for (int i = 0, size = childNodes.getLength(); i < size; i++) {
Node item = childNodes.item(i);
if (item instanceof Element) {
Element child = (Element) item;
if (firstChildTextContent(child, "artifactId", artifactId)) {
return false;
}
}
}
plugins.appendChild(doc.createTextNode("\n "));
Element plugin = DomHelper.addChildElement(plugins, "plugin");
plugin.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(plugin, "artifactId", artifactId);
plugin.appendChild(doc.createTextNode("\n "));
DomHelper.addChildElement(plugin, "version", failsafeVersion);
plugin.appendChild(doc.createTextNode("\n "));
Element configuration = DomHelper.addChildElement(plugin, "configuration");
configuration.appendChild(doc.createTextNode("\n "));
Element includes = DomHelper.addChildElement(configuration, "includes");
includes.appendChild(doc.createTextNode("\n "));
Element include = DomHelper.addChildElement(includes, "include", "**/*KT.*");
includes.appendChild(doc.createTextNode("\n "));
configuration.appendChild(doc.createTextNode("\n "));
plugin.appendChild(doc.createTextNode("\n "));
plugins.appendChild(doc.createTextNode("\n "));
return true;
}