public static Element getChildElementByTagName ( Element ele , String childEleName ) { Assert . notNull ( ele , "Element must not be null" ) ; Assert . notNull ( childEleName , "Element name must not be null" ) ; NodeList nl = ele . getChildNodes ( ) ; for ( int i = 0 ; i < nl . getLength ( ) ; i ++ ) { Node node = nl . item ( i ) ; if ( node instanceof Element && nodeNameMatch ( node , childEleName ) ) { return ( Element ) node ; } } return null ; }
Utility method that returns the first child element identified by its name .