public static List < Element > getChildren ( Element parent , String childName ) { ArrayList < Element > children = new ArrayList < Element > ( ) ; NodeList nodes = parent . getChildNodes ( ) ; for ( int i = 0 ; i < nodes . getLength ( ) ; ++ i ) { Node node = nodes . item ( i ) ; if ( ( node instanceof Element ) && node . getNodeName ( ) . equals ( childName ) ) children . add ( ( Element ) node ) ; } return children ; }
Return the children with the given name .