Android examples for XML:XML Node
remove Direct XML Children from Node
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static void removeDirectChildren(Node parent) { NodeList childNodes = parent.getChildNodes(); while (childNodes.getLength() > 0) { parent.removeChild(childNodes.item(0)); }/*w ww .j a v a 2 s . co m*/ } }