private void doText ( Element received , Element source ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Validating node value for element: " + received . getLocalName ( ) ) ; } String receivedText = DomUtils . getTextValue ( received ) ; String sourceText = DomUtils . getTextValue ( source ) ; if ( receivedText != null ) { Assert . isTrue ( sourceText != null , ValidationUtils . buildValueMismatchErrorMessage ( "Node value not equal for element '" + received . getLocalName ( ) + "'" , null , receivedText . trim ( ) ) ) ; Assert . isTrue ( receivedText . trim ( ) . equals ( sourceText . trim ( ) ) , ValidationUtils . buildValueMismatchErrorMessage ( "Node value not equal for element '" + received . getLocalName ( ) + "'" , sourceText . trim ( ) , receivedText . trim ( ) ) ) ; } else { Assert . isTrue ( sourceText == null , ValidationUtils . buildValueMismatchErrorMessage ( "Node value not equal for element '" + received . getLocalName ( ) + "'" , sourceText . trim ( ) , null ) ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Node value '" + receivedText . trim ( ) + "': OK" ) ; } }
Handle text node during validation .