本文整理汇总了Java中org.w3c.dom.Element.removeChild方法的典型用法代码示例。如果您正苦于以下问题:Java Element.removeChild方法的具体用法?Java Element.removeChild怎么用?Java Element.removeChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.Element
的用法示例。
在下文中一共展示了Element.removeChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeDependenciesByCNB
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Use this for removing more than one dependencies. It's faster then
* iterating and using <code>removeDependency</code> for every entry.
*/
public void removeDependenciesByCNB(Collection<String> cnbsToDelete) {
Element _confData = getConfData();
Element moduleDependencies = findModuleDependencies(_confData);
for (Element dep : XMLUtil.findSubElements(moduleDependencies)) {
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE);
String _cnb = XMLUtil.findText(cnbEl);
if (cnbsToDelete.remove(_cnb)) {
moduleDependencies.removeChild(dep);
}
if (cnbsToDelete.size() == 0) {
break; // everything was deleted
}
}
if (cnbsToDelete.size() != 0) {
Util.err.log(ErrorManager.WARNING,
"Some modules weren't deleted: " + cnbsToDelete); // NOI18N
}
project.putPrimaryConfigurationData(_confData);
directDeps = null;
}
示例2: editDependency
import org.w3c.dom.Element; //导入方法依赖的package包/类
public void editDependency(ModuleDependency origDep, ModuleDependency newDep) {
Element _confData = getConfData();
Element moduleDependencies = findModuleDependencies(_confData);
List<Element> currentDeps = XMLUtil.findSubElements(moduleDependencies);
for (Iterator<Element> it = currentDeps.iterator(); it.hasNext();) {
Element dep = it.next();
Element cnbEl = findElement(dep, ProjectXMLManager.CODE_NAME_BASE);
String _cnb = XMLUtil.findText(cnbEl);
if (_cnb.equals(origDep.getModuleEntry().getCodeNameBase())) {
moduleDependencies.removeChild(dep);
Element nextDep = it.hasNext() ? it.next() : null;
createModuleDependencyElement(moduleDependencies, newDep, nextDep);
break;
}
}
project.putPrimaryConfigurationData(_confData);
directDeps = null;
}
示例3: ToXmlValores
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
protected void ToXmlValores(Document doc, Element me) {
super.ToXmlValores(doc, me);
me.appendChild(util.XMLGenerate.ValorInteger(doc, "Alinhamento", getAlinhamento().ordinal()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "CentrarVertical", isCentrarVertical()));
me.appendChild(util.XMLGenerate.ValorInteger(doc, "Tipo", getTipo().ordinal()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "Autosize", isAutosize()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "MovimentacaoManual", isMovimentacaoManual()));
//remover dicionário do XML do objeto.
NodeList nl = me.getElementsByTagName("Dicionario");
if (nl != null && nl.getLength() > 0) {
me.removeChild(nl.item(0));
}
}
示例4: mergeXMLFiles
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static Document mergeXMLFiles(final List tempFiles, final String rootElementName) throws ParserConfigurationException, SAXException, IOException {
final Document mergedDocument = createDomDocument();
final Element element = mergedDocument.createElement(rootElementName);
mergedDocument.appendChild(element);
for (final Iterator i = tempFiles.iterator(); i.hasNext();) {
final File file = (File)i.next();
if (file.isDirectory()) continue;
final Document documentToMerge = parseDom(file, false);
// NOTE: vimeshev - cleanup to reduce XML size.
final NodeList elementsByTagName = documentToMerge.getElementsByTagName("properties");
final int length = elementsByTagName.getLength();
final Element root = documentToMerge.getDocumentElement();
for (int j = 0; j < length; j++) {
final Node node = elementsByTagName.item(j);
root.removeChild(node);
}
// merge
final NodeList list = documentToMerge.getElementsByTagName("*");
final Element rootElement = (Element)list.item(0);
final Node duplicate = mergedDocument.importNode(rootElement, true);
mergedDocument.getDocumentElement().appendChild(duplicate);
}
return mergedDocument;
}
示例5: removeSpi
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Removes a given key from this node on the backing store.
* @param key the key to be removed
*/
protected void removeSpi(String key) {
Element node = myXMLNode();
if (node != null) {
Element map = (Element)node.getElementsByTagName("map").item(0);
NodeList entries = myEntries();
for (int i=0 ; i<entries.getLength() ; i++) {
Element entry = (Element)entries.item(i);
String nodeKey = entry.getAttribute("key");
if (nodeKey.equals(key)) {
map.removeChild(entry);
}
}
}
}
示例6: removeUserDefinedNodes
import org.w3c.dom.Element; //导入方法依赖的package包/类
private void removeUserDefinedNodes(Element parent) {
HashSet<Node> toRemove = new HashSet<>();
NodeList list = parent.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
((Element) node).removeAttribute("done");
((Element) node).removeAttribute("hashcode");
if (node.getNodeName().equals("schema-type")) {
toRemove.add(node);
}
else {
removeUserDefinedNodes((Element) node);
}
}
}
Iterator<Node> it = toRemove.iterator();
while (it.hasNext()) {
parent.removeChild(it.next());
}
toRemove.clear();
}
示例7: setFolders
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Sets the folders of this get response.
*
* @see Connector#getFolders(ResourceType, String)
* @param folders
* the folders of this get response
*/
public void setFolders(final List<String> folders) {
if (foldersElement != null) {
Element parent = (Element) foldersElement.getParentNode();
parent.removeChild(foldersElement);
}
foldersElement = document.createElement("Folders");
document.getDocumentElement().appendChild(foldersElement);
for (String folder : folders) {
Element folderElement = document.createElement("Folder");
folderElement.setAttribute("name", folder);
foldersElement.appendChild(folderElement);
}
}
示例8: flipTable
import org.w3c.dom.Element; //导入方法依赖的package包/类
private Element flipTable(Element table) {
// create lines for each column found in the first source line
NodeList srcLines = table.getChildNodes();
NodeList srcCols = srcLines.item(0).getChildNodes();
int nbSrcLines = srcLines.getLength();
int nbSrcCols = srcCols.getLength();
// for each column create a line from the source column names.
for (int i = 0; i < nbSrcCols; i++) {
Element destLine = table.getOwnerDocument().createElement(srcCols.item(i).getNodeName());
// in this line create Columns from the source line names.
for (int j = 0; j < nbSrcLines; j++) {
Element destCol = table.getOwnerDocument().createElement(srcLines.item(j).getNodeName());
Node textNode = srcLines.item(j).getChildNodes().item(i).getFirstChild().cloneNode(true);
destCol.appendChild(textNode);
destLine.appendChild(destCol);
}
table.appendChild(destLine);
}
// clean source table;
for (int j = 0; j < nbSrcLines; j++) {
table.removeChild(srcLines.item(0));
}
return table;
}
示例9: removeNodeSpi
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Removes this node from the backing store. Please note that, though the
* AbstractPreferences method signature defines that this method should
* throw a BackingStoreException, this implementation doesn't.
*/
protected void removeNodeSpi() throws BackingStoreException {
org.w3c.dom.Node root = PreferencesController.getInstance().getXMLDocument().getDocumentElement();
Element myNode = myXMLNode();
Element parentNode = (Element)myNode.getParentNode();
if(root.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
Element docRoot = (Element) root;
parentNode.removeChild(myNode);
}
}
示例10: ToXmlValores
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
protected void ToXmlValores(Document doc, Element me) {
super.ToXmlValores(doc, me);
//remover Bounds.
NodeList nl = me.getElementsByTagName("Bounds");
me.removeChild(nl.item(0));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "Inteligente", isInteligente()));
if (!getForeColor().equals(Elementar.defaultColor)) {
me.appendChild(util.XMLGenerate.ValorColor(doc, "ForeColor", getForeColor()));
}
me.appendChild(util.XMLGenerate.ValorInteger(doc, "Largura", (int) getLargura()));
//me.appendChild(util.XMLGenerate.ValorInteger(doc, "Fator_Largura", (int)fator_largura));
Element lig = doc.createElement("Ligacoes");
util.XMLGenerate.AtributoRefFormElementar(lig, "PontaA", getFormaPontaA());
util.XMLGenerate.AtributoRefFormElementar(lig, "PontaB", getFormaPontaB());
me.appendChild(lig);
Element sbPontos = doc.createElement("Pontos");
for (PontoDeLinha pl : getPontos()) {
sbPontos.appendChild(util.XMLGenerate.ValorPoint(doc, "Ponto", pl.getLocation()));
}
me.appendChild(sbPontos);
PreCardinalidade card = getCard();
if (card != null) {
card.ToXlm(doc, me);
}
}
示例11: removeClassPathExtensions
import org.w3c.dom.Element; //导入方法依赖的package包/类
public void removeClassPathExtensions() {
Element _confData = getConfData();
NodeList nl = _confData.getElementsByTagNameNS(NbModuleProject.NAMESPACE_SHARED,
ProjectXMLManager.CLASS_PATH_EXTENSION);
int len = nl.getLength();
for (int i = 0; i < len; i++) {
_confData.removeChild(nl.item(0));
}
cpExtensions = Collections.emptyMap();
project.putPrimaryConfigurationData(_confData);
}
示例12: ToXmlValores
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
protected void ToXmlValores(Document doc, Element me) {
super.ToXmlValores(doc, me);
me.appendChild(util.XMLGenerate.ValorText(doc, "Titulo", getTitulo()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "PaintTitulo", isPaintTitulo()));
me.appendChild(util.XMLGenerate.ValorInteger(doc, "Alinhamento", getAlinhamento().ordinal()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "CentrarVertical", isCentrarVertical()));
me.appendChild(util.XMLGenerate.ValorInteger(doc, "Tipo", getTipo().ordinal()));
me.appendChild(util.XMLGenerate.ValorColor(doc, "BackColor", getBackColor()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "Sombra", isSombra()));
me.appendChild(util.XMLGenerate.ValorColor(doc, "CorSombra", getCorSombra()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "Gradiente", isGradiente()));
me.appendChild(util.XMLGenerate.ValorColor(doc, "GradienteStartColor", getGradienteStartColor()));
me.appendChild(util.XMLGenerate.ValorColor(doc, "GradienteEndColor", getGradienteEndColor()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "GradientePinteDetalhe", isGradientePinteDetalhe()));
me.appendChild(util.XMLGenerate.ValorColor(doc, "GradienteCorDetalhe", getGradienteCorDetalhe()));
me.appendChild(util.XMLGenerate.ValorInteger(doc, "GDirecao", getGDirecao()));
me.appendChild(util.XMLGenerate.ValorInteger(doc, "Alfa", (int)(100 * getAlfa())));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "Autosize", isAutosize()));
me.appendChild(util.XMLGenerate.ValorBoolean(doc, "MovimentacaoManual", isMovimentacaoManual()));
//remover dicionário do XML do objeto.
NodeList nl = me.getElementsByTagName("Dicionario");
if (nl != null && nl.getLength() > 0) {
me.removeChild(nl.item(0));
}
}
示例13: visitAccessFlags
import org.w3c.dom.Element; //导入方法依赖的package包/类
public void visitAccessFlags(AccessFlags flags) {
String sNodeName = "";
if (currElem.getNodeName().startsWith("ce:JavaClass")) {
sNodeName = "ClassAccessFlags";
} else if (currElem.getNodeName().startsWith("Field")) {
sNodeName = "FieldAccessFlags";
} else if (currElem.getNodeName().startsWith("Method")) {
sNodeName = "MethodAccessFlags";
} else if (currElem.getNodeName().startsWith("InnerClassInfo")) {
sNodeName = "InnerClassAccessFlags";
}
Element prevElem = currElem;
currElem = doc.createElement(sNodeName);
prevElem.appendChild(currElem);
if (!sNodeName.equals("ClassAccessFlags")) {
if (flags.isSynchronized()) currElem.setAttribute("synchronized", Boolean.toString(flags.isSynchronized()));
}
if (flags.isNative()) currElem.setAttribute("native", Boolean.toString(flags.isNative()));
if (flags.isAbstract()) currElem.setAttribute("abstract", Boolean.toString(flags.isAbstract()));
if (flags.isInterface()) currElem.setAttribute("interface", Boolean.toString(flags.isInterface()));
if (flags.isTransient()) currElem.setAttribute("transient", Boolean.toString(flags.isTransient()));
if (flags.isVolatile()) currElem.setAttribute("volatile", Boolean.toString(flags.isVolatile()));
if (flags.isSuper()) currElem.setAttribute("super", Boolean.toString(flags.isSuper()));
if (flags.isFinal()) currElem.setAttribute("final", Boolean.toString(flags.isFinal()));
if (flags.isStatic()) currElem.setAttribute("static", Boolean.toString(flags.isStatic()));
if (flags.isProtected()) currElem.setAttribute("protected", Boolean.toString(flags.isProtected()));
if (flags.isPrivate()) currElem.setAttribute("private", Boolean.toString(flags.isPrivate()));
if (flags.isPublic()) currElem.setAttribute("public", Boolean.toString(flags.isPublic()));
super.visitAccessFlags(flags);
// if no attributes were set, remove the node
if ((currElem.getAttributes().getLength() == 0) && (currElem.getChildNodes().getLength() == 0)) {
prevElem.removeChild(currElem);
}
currElem = prevElem;
}
示例14: removeNodeSpi
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Removes this node from the backing store. Please note that, though the
* AbstractPreferences method signature defines that this method should
* throw a BackingStoreException, this implementation doesn't.
*/
protected void removeNodeSpi() throws BackingStoreException {
org.w3c.dom.Node root = AIPreferencesController.getInstance().getXMLDocument().getDocumentElement();
Element myNode = myXMLNode();
Element parentNode = (Element)myNode.getParentNode();
if(root.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
Element docRoot = (Element) root;
parentNode.removeChild(myNode);
}
}
示例15: deleteTagContents
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* This method removes all child elements with the given name of the given element.
*/
public static void deleteTagContents(Element parentElement, String name) {
NodeList children = parentElement.getElementsByTagName(name);
for (int i = 0; i < children.getLength(); i++) {
Element child = (Element) children.item(i);
parentElement.removeChild(child);
}
}