Java Utililty Methods XML Element Remove

List of utility methods to do XML Element Remove

Description

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

Method

voidremoveWhitespaces(Element element)
remove Whitespaces
NodeList children = element.getChildNodes();
for (int i = 0; i < children.getLength();) {
    Node n = children.item(i);
    if (n instanceof Element) {
        removeWhitespaces((Element) n);
        ++i;
    } else if (n instanceof Text && ((Text) n).getTextContent().trim().length() == 0) {
        element.removeChild(n);
...
voidremoveXmlBase(Element e)
remove Xml Base
e.removeAttributeNS("http://www.w3.org/XML/1998/namespace", "base"); 
e.removeAttribute("xml:base");