Java XML Child Remove All removeAllChildren(org.w3c.dom.Element element)

Here you can find the source of removeAllChildren(org.w3c.dom.Element element)

Description

remove All Children

License

Open Source License

Declaration

public static void removeAllChildren(org.w3c.dom.Element element) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Node;

public class Main {
    public static void removeAllChildren(org.w3c.dom.Element element) {
        if (element == null) {
            return;
        }/*  w ww .  ja  v a2s.  co  m*/
        for (int index = 0; index < element.getChildNodes().getLength(); index++) {
            Node child = element.getChildNodes().item(0);
            element.removeChild(child);
        }
    }
}

Related

  1. removeAllChildren(Node node)
  2. removeAllChildren(Node node)
  3. removeAllChildren(Node node)
  4. removeAllChildren(Node node)
  5. removeAllChildren(Node node)
  6. removeAllChildrenNotElement(Element parentElem)
  7. removeAllChildrenOfNode(Node node)
  8. removeAllNamedChild(Element parent, String name)