public static Element getChild ( Element parent , String childName ) { 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 ) ) return ( Element ) node ; } return null ; }
Return the first child of the given name or null .