private final static void traverse ( Element element , ElementVisitor visitor ) { visitor . visit ( element ) ; NodeList children = element . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { Node node = children . item ( i ) ; if ( node . getNodeType ( ) != Node . ELEMENT_NODE ) continue ; traverse ( ( Element ) node , visitor ) ; } }
Used to traverse an XML document .