@Override public EvaluateStatement doParse( Element element, Statement[] parentPath, BeneratorParseContext context) { boolean evaluate = DescriptorConstants.EL_EVALUATE.equals(element.getNodeName()); if (evaluate) { assertAtLeastOneAttributeIsSet(element, ATT_ID, ATT_ASSERT); } else { assertAttributeIsNotSet(element, ATT_ID); assertAttributeIsNotSet(element, ATT_ASSERT); } Expression<String> id = parseAttribute(ATT_ID, element); Expression<String> text = new StringExpression(parseScriptableElementText(element, false)); Expression<String> uri = parseScriptableStringAttribute(ATT_URI, element); Expression<String> type = parseAttribute(ATT_TYPE, element); Expression<?> targetObject = new FeatureAccessExpression<Object>(element.getAttribute(ATT_TARGET)); Expression<Character> separator = new ConvertingExpression<String, Character>( parseScriptableStringAttribute(ATT_SEPARATOR, element), new String2CharConverter()); Expression<String> onError = parseScriptableStringAttribute(ATT_ON_ERROR, element); Expression<String> encoding = parseScriptableStringAttribute(ATT_ENCODING, element); Expression<Boolean> optimize = parseBooleanExpressionAttribute(ATT_OPTIMIZE, element, false); Expression<Boolean> invalidate = parseBooleanExpressionAttribute(ATT_INVALIDATE, element, null); Expression<?> assertion = new ScriptExpression<Object>(element.getAttribute(ATT_ASSERT)); return new EvaluateStatement( evaluate, id, text, uri, type, targetObject, separator, onError, encoding, optimize, invalidate, assertion); }
@Override public boolean supports(Element element, Statement[] parentPath) { String name = element.getNodeName(); return DescriptorConstants.EL_EVALUATE.equals(name) || DescriptorConstants.EL_EXECUTE.equals(name); }