// determine script source
Element scriptElement = scriptTaskElement.element("script");
String scriptResource = scriptTaskElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "resource");
if (scriptElement != null) {
String scriptSource = scriptElement.getText();
return new ScriptTaskActivityBehavior(parseScriptSource(scriptSource, language), resultVariableName);
} else if (scriptResource != null) {
try {
return new ScriptTaskActivityBehavior(parseScriptResource(scriptResource, language), resultVariableName);
} catch (ProcessEngineException e) {
addError("Unable to load script file from resource " + scriptResource, scriptTaskElement);
}
}