Java Utililty Methods XML Child Remove

List of utility methods to do XML Child Remove

Description

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

Method

voidremoveChildren(Element element)
remove Children
while (element != null && element.hasChildNodes()) {
    element.removeChild(element.getFirstChild());
voidremoveChildren(Element element)
remove Children
while (true) {
    Node child = element.getFirstChild();
    if (child == null) {
        return;
    element.removeChild(child);
voidremoveChildren(Element parent)
Remove all children from a XML parent
Node node = parent.getFirstChild();
while (node != null) {
    Node removeNode = node;
    node = node.getNextSibling();
    parent.removeChild(removeNode);
voidremoveChildren(final Node node)
remove Children
if (node == null)
    return;
NodeList nodeList = node.getChildNodes();
if (nodeList == null)
    return;
int l = nodeList.getLength();
for (int i = 0; i < l; i++) {
    Node n = nodeList.item(i);
...
intremoveChildren(Node aNode)
remove Children
if (aNode == null) {
    return 0;
int wNbRemoved = 0;
Node wNode;
while (aNode.hasChildNodes()) {
    wNode = aNode.getFirstChild();
    aNode.removeChild(wNode);
...
voidremoveChildren(Node e)
remove Children
NodeList list = e.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
    Node n = list.item(i);
    e.removeChild(n);
NoderemoveChildren(Node node)
Removes all the children of a given Node
if (node.getNodeType() == Node.ELEMENT_NODE)
    NodeList children = node.getChildNodes();
    for (int i = 0; i < children.getLength(); i++)
        Node child = children.item(i);
        Node temp = node.removeChild(child);
        i--;
...
voidremoveChildren(Node node)
Remove all child nodes from the supplied node.
NodeList children = node.getChildNodes();
int nodeCount = children.getLength();
for (int i = 0; i < nodeCount; i++) {
    node.removeChild(children.item(0));
voidremoveChildren(Node node)
remove Children
NodeList children = node.getChildNodes();
if (children != null) {
    int len = children.getLength();
    for (int i = len - 1; i >= 0; i--) {
        node.removeChild(children.item(i));
voidremoveChildren(Node node)
remove Children
if (node != null) {
    while (node.hasChildNodes()) {
        node.removeChild(node.getFirstChild());