Java XML Child Remove All removeAllChildren(Node node)

Here you can find the source of removeAllChildren(Node node)

Description

Removes all children of the specified node.

License

BSD License

Parameter

Parameter Description
node the node.

Declaration

public static void removeAllChildren(Node node) 

Method Source Code


//package com.java2s;
/*/* ww w.j ava 2  s.co  m*/
 * Copyright (c) 2012. betterFORM Project - http://www.betterform.de
 * Licensed under the terms of BSD License
 */

import org.w3c.dom.*;

public class Main {
    /**
     * Removes all children of the specified node.
     *
     * @param node the node.
     */
    public static void removeAllChildren(Node node) {
        Node child;
        while ((child = node.getFirstChild()) != null) {
            node.removeChild(child);
        }
    }
}

Related

  1. removeAllChildren(final Node node)
  2. removeAllChildren(Node node)
  3. removeAllChildren(Node node)
  4. removeAllChildren(Node node)
  5. removeAllChildren(Node node)
  6. removeAllChildren(Node node)
  7. removeAllChildren(Node node)
  8. removeAllChildren(org.w3c.dom.Element element)
  9. removeAllChildrenNotElement(Element parentElem)