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

voidremoveChild(Element parent, String name)
remove Child
NodeList children = parent.getChildNodes();
if (children == null)
    return;
for (int i = 0; i < children.getLength(); i++) {
    Node child = children.item(i);
    if (child.getNodeName().equalsIgnoreCase(name)) {
        parent.removeChild(child);
voidremoveChild(final Node node, final Node child)
remove Child
if (node != null) {
    node.removeChild(child);
NoderemoveChild(Node xmlNode, String name, boolean ignoreCase)
remove Child
Node removedChild = null;
String key = name;
if (ignoreCase)
    key = key.toLowerCase();
NodeList childNodes = xmlNode.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
    Node child = childNodes.item(i);
    String childName = child.getNodeName();
...
voidremoveChild(NodeList nodes)
remove Child
for (int i = 0; i < nodes.getLength(); i++) {
    nodes.item(i).getParentNode().removeChild(nodes.item(i));
voidremoveChildElements(Element parent)
removes all children of element type
List v = getChildElements(parent);
Iterator en = v.iterator();
while (en.hasNext())
    parent.removeChild((Node) en.next());
voidremoveChildNodes(Node node)
remove Child Nodes
for (Node current = node.getFirstChild(), next; current != null; current = next) {
    next = current.getNextSibling();
    node.removeChild(current);
voidremoveChildNodes(Node node)
remove Child Nodes
NodeList nl = node.getChildNodes();
while (nl.getLength() > 0)
    node.removeChild(nl.item(0));
voidremoveChildNodes(Node node, short... ignoreNodeTypes)
remove Child Nodes
HashSet<Node> childNodesSet = getValidChildNodes(node, false, ignoreNodeTypes);
for (Node childNode : childNodesSet) {
    node.removeChild(childNode);
voidremoveChildNodes(Node parent)
remove Child Nodes
while (parent.hasChildNodes()) {
    parent.removeChild(parent.getFirstChild());
voidremoveChildren(Element el)
Remove all childs element from el
while (el.getChildNodes().getLength() > 0) {
    el.removeChild(el.getChildNodes().item(0));