protected Text extractText ( Element fromElement ) { fromElement . normalize ( ) ; NodeList fromNodeList = fromElement . getChildNodes ( ) ; Node currentNode ; for ( int i = 0 ; i < fromNodeList . getLength ( ) ; ++ i ) { currentNode = fromNodeList . item ( i ) ; if ( currentNode . getNodeType ( ) == Node . TEXT_NODE ) { return ( Text ) currentNode ; } } return null ; }
Extract the normalized text from within an element