Example #1
0
 private void removeNodes(NodeList nl) {
   int count = nl.getLength();
   for (int i = 0; i < count; i++) {
     Node node = nl.item(i);
     Node parent = node.getParentNode();
     if (parent == null) continue;
     parent.removeChild(node);
   }
 }
Example #2
0
 private void setXmlEntry(Document doc, Node opSet) {
   NodeList targetNodes = findNodes(doc, opSet);
   NodeList valueNodes = getValueNodes(opSet);
   if (targetNodes == null) {
     return;
   }
   int targetNodesCount = targetNodes.getLength();
   for (int i = 0; i < targetNodesCount; i++) {
     Node target = targetNodes.item(i);
     for (Node child; (child = target.getFirstChild()) != null; target.removeChild(child)) ;
     appendNodes(doc, target, valueNodes);
   }
 }
Example #3
0
 private void replaceXmlEntry(Document doc, Node opReplace) {
   NodeList targetNodes = findNodes(doc, opReplace);
   NodeList valueNodes = getValueNodes(opReplace);
   if (targetNodes == null) {
     return;
   }
   int targetNodesCount = targetNodes.getLength();
   for (int i = 0; i < targetNodesCount; i++) {
     Node target = targetNodes.item(i);
     Node parent = target.getParentNode();
     if (parent == null) continue;
     parent.removeChild(target);
     appendNodes(doc, parent, valueNodes);
   }
 }
Example #4
0
 /**
  * @webref xml:method
  * @brief Removes the specified child
  */
 public void removeChild(XML kid) {
   node.removeChild(kid.node);
   children = null; // TODO not efficient
 }