Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static void removeElement(Element parent, String tagName) { NodeList nl = parent.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node nd = nl.item(i); if (nd.getNodeName().equals(tagName)) { parent.removeChild(nd); } } } }