Java XML Child Remove All removeAllChildren(Element deps)

Here you can find the source of removeAllChildren(Element deps)

Description

remove All Children

License

Apache License

Declaration

public static void removeAllChildren(Element deps) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static void removeAllChildren(Element deps) {
        NodeList childNodes = deps.getChildNodes();

        for (int i = childNodes.getLength() - 1; i >= 0; i--) {
            Node item = childNodes.item(i);
            deps.removeChild(item);// w w w .  j  a v a  2 s.  c  o m
        }
    }
}

Related

  1. removeAllChildElements(@Nonnull final Element aElement)
  2. removeAllChildNodes(Node node)
  3. removeAllChildNodes(Node node)
  4. removeAllChildNodes(Node node)
  5. removeAllChildNodes(Node node, String name)
  6. removeAllChildren(Element node, String elementName)
  7. removeAllChildren(final Element element)
  8. removeAllChildren(final Node node)
  9. removeAllChildren(Node node)