Here you can find the source of removeAttribute(Node parent, String name, String value, boolean recursive)
public static void removeAttribute(Node parent, String name, String value, boolean recursive)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static void removeAttribute(Node parent, String name, String value, boolean recursive) { NamedNodeMap nnm = parent.getAttributes(); if (nnm != null) if (value == null) nnm.removeNamedItem(name); else { Node attr = nnm.getNamedItem(name); if (attr != null) { String attrVal = attr.getNodeValue(); if (value.equals(attrVal)) nnm.removeNamedItem(name); }// w w w . ja v a2 s . c o m } if (recursive) for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) removeAttribute(child, name, value, recursive); } }