question: private synchronized static void removeChildren ( Node node , short type , boolean deep ) { NodeList list = node . getChildNodes ( ) ; for ( int i = list . getLength ( ) ; i >= 0 ; i -- ) { Node n = list . item ( i ) ; if ( n == null ) continue ; if ( n . getNodeType ( ) == type || type == UNDEFINED_NODE ) node . removeChild ( XMLCaster . toRawNode ( n ) ) ; else if ( deep ) removeChildren ( n , type , deep ) ; } }
target:  removes child elements from a specific type