private ScriptValidationContext getScriptValidationContext ( Element messageElement , String messageType ) { ScriptValidationContext context = null ; boolean done = false ; List < ? > validateElements = DomUtils . getChildElementsByTagName ( messageElement , "validate" ) ; if ( validateElements . size ( ) > 0 ) { for ( Iterator < ? > iter = validateElements . iterator ( ) ; iter . hasNext ( ) ; ) { Element validateElement = ( Element ) iter . next ( ) ; Element scriptElement = DomUtils . getChildElementByTagName ( validateElement , "script" ) ; // check for nested validate script child node if ( scriptElement != null ) { if ( ! done ) { done = true ; } else { throw new BeanCreationException ( "Found multiple validation script definitions - " + "only supporting a single validation script for message validation" ) ; } context = new ScriptValidationContext ( messageType ) ; String type = scriptElement . getAttribute ( "type" ) ; context . setScriptType ( type ) ; String filePath = scriptElement . getAttribute ( "file" ) ; if ( StringUtils . hasText ( filePath ) ) { context . setValidationScriptResourcePath ( filePath ) ; if ( scriptElement . hasAttribute ( "charset" ) ) { context . setValidationScriptResourceCharset ( scriptElement . getAttribute ( "charset" ) ) ; } } else { context . setValidationScript ( DomUtils . getTextValue ( scriptElement ) ) ; } } } } return context ; }
Construct the message validation context .