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

voidremoveAllChildElements(@Nonnull final Element aElement)
Remove all child nodes of the given node.
while (aElement.getChildNodes().getLength() > 0)
    aElement.removeChild(aElement.getChildNodes().item(0));
voidremoveAllChildNodes(Node node)
Removes all child nodes from the given node.
NodeList children = node.getChildNodes();
while (children.getLength() > 0) {
    node.removeChild(children.item(0));
voidremoveAllChildNodes(Node node)
remove All Child Nodes
while (node.hasChildNodes()) {
    node.removeChild(node.getLastChild());
voidremoveAllChildNodes(Node node)
Removes all child nodes from the context Node node.
NodeList children = node.getChildNodes();
for (int j = children.getLength() - 1; j >= 0; node.removeChild(children.item(j)), j--)
    ;
voidremoveAllChildNodes(Node node, String name)
removes any immediate child nodes with the given name.
ArrayList<Node> removeList = getChildNodes(node, name);
for (Node temp : removeList) {
    node.removeChild(temp);
voidremoveAllChildren(Element deps)
remove All Children
NodeList childNodes = deps.getChildNodes();
for (int i = childNodes.getLength() - 1; i >= 0; i--) {
    Node item = childNodes.item(i);
    deps.removeChild(item);
voidremoveAllChildren(Element node, String elementName)
Delete children elements for Element by element name
if (node != null) {
    NodeList nl = node.getChildNodes();
    int len = nl.getLength();
    for (int i = 0; i < len; i++) {
        Node childNode = nl.item(i);
        if (childNode != null && childNode.getLocalName() != null
                && childNode.getLocalName().equals(elementName))
            node.removeChild(childNode);
...
voidremoveAllChildren(final Element element)
Simply removes all child nodes.
for (Node n = element.getFirstChild(); n != null; n = element.getFirstChild()) {
    element.removeChild(n);
voidremoveAllChildren(final Node node)
Removes all children of the specified node.
Node child;
while ((child = node.getFirstChild()) != null) {
    node.removeChild(child);
voidremoveAllChildren(Node node)
Remove all the children of
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
    node.removeChild(list.item(i));