private boolean containsElmentWithId ( Node node , String id ) { String nodeName = node . getNodeName ( ) ; if ( "channel" . equals ( nodeName ) || "folder" . equals ( nodeName ) ) { Element e = ( Element ) node ; if ( id . equals ( e . getAttribute ( "ID" ) ) ) { return true ; } if ( "folder" . equals ( nodeName ) ) { for ( Node child = e . getFirstChild ( ) ; child != null ; child = child . getNextSibling ( ) ) { if ( containsElmentWithId ( child , id ) ) { return true ; } } } } return false ; }
Recursevly find out whether node contains a folder or channel with given identifier .