Java Utililty Methods XML Child Remove All

List of utility methods to do XML Child Remove All

Description

The list of methods to do XML Child Remove All are organized into topic(s).

Method

voidremoveAllChildren(Node node)
remove All Children
while (node.getFirstChild() != null)
    node.removeChild(node.getFirstChild());
voidremoveAllChildren(Node node)
remove All Children
while (node.hasChildNodes())
    node.removeChild(node.getFirstChild());
voidremoveAllChildren(Node node)
Remove all children from the specified node
while (node.hasChildNodes())
    node.removeChild(node.getLastChild());
voidremoveAllChildren(Node node)
Removes all children of the specified node.
Node child;
while ((child = node.getFirstChild()) != null) {
    node.removeChild(child);
booleanremoveAllChildren(Node node)
remove All Children
Node child = node.getFirstChild();
if (child == null)
    return false; 
while (child != null) {
    Node nextChild = child.getNextSibling();
    node.removeChild(child);
    child = nextChild;
return true;
voidremoveAllChildren(Node node)
Removes all children nodes from the specified node.
Node firstChild = node.getFirstChild();
while (firstChild != null) {
    Node nodeToRemove = firstChild;
    firstChild = firstChild.getNextSibling();
    node.removeChild(nodeToRemove);
voidremoveAllChildren(org.w3c.dom.Element element)
remove All Children
if (element == null) {
    return;
for (int index = 0; index < element.getChildNodes().getLength(); index++) {
    Node child = element.getChildNodes().item(0);
    element.removeChild(child);
voidremoveAllChildrenNotElement(Element parentElem)
remove All Children Not Element
Node node = parentElem.getFirstChild();
while (node != null) {
    if (node.getNodeType() != Node.ELEMENT_NODE) {
        Node next = node.getNextSibling();
        parentElem.removeChild(node);
        node = next;
    } else {
        node = node.getNextSibling();
...
voidremoveAllChildrenOfNode(Node node)
remove All Children Of Node
for (int i = 0; i < node.getChildNodes().getLength(); i++) {
    Node n = node.getChildNodes().item(i);
    if (n.hasChildNodes()) 
        removeAllChildrenOfNode(n);
        node.removeChild(n);
    } else
        node.removeChild(n);
...
voidremoveAllNamedChild(Element parent, String name)
remove All Named Child
NodeList childNdList = parent.getChildNodes();
for (int i = 0; i < childNdList.getLength(); i++) {
    org.w3c.dom.Node n = childNdList.item(i);
    if (n == null) {
        continue; 
    if (n.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) {
        continue;
...