/** Returns whether it is a ZK attribute (in a non-ZK element). * @param bNativeContent whether to ignore if URI not specified explicitly */ private static final boolean isZkAttr(LanguageDefinition langdef, Namespace attrns, boolean bNativeContent) { //if native we will make sure URI is ZK or lang's namespace if ((bNativeContent || langdef.isNative()) && attrns != null && "".equals(attrns.getPrefix())) return false; //if navtive, "" means not ZK return isZkElementAttr(langdef, attrns); }
private static void parseVariables(LanguageDefinition langdef, NodeInfo parent, Element el, AnnotationHelper annHelper) throws Exception { //if (!el.getElements().isEmpty()) // throw new UiException(message("Child elements are not allowed for <variables> element", el)); if (annHelper.clear()) log.warn(message("Annotations are ignored since <variables> doesn't support them", el)); //old style annotation not supported here String ifc = null, unless = null, composite = null; boolean local = false; final Map<String, String> vars = new LinkedHashMap<String, String>(); for (final Attribute attr : el.getAttributeItems()) { final Namespace attrns = attr.getNamespace(); final String attnm = attr.getLocalName(); final String attval = attr.getValue(); if ("if".equals(attnm) && isZkElementAttr(langdef, attrns)) { ifc = attval; } else if ("unless".equals(attnm) && isZkElementAttr(langdef, attrns)) { unless = attval; } else if ("local".equals(attnm) && isZkElementAttr(langdef, attrns)) { local = "true".equals(attval); } else if ("composite".equals(attnm) && isZkElementAttr(langdef, attrns)) { composite = attval; } else if ("forEach".equals(attnm) && isZkElementAttr(langdef, attrns)) { throw new UiException(message("forEach not applicable to <variables>", el)); } else { vars.put(attnm, attval); } } if (!vars.isEmpty()) new VariablesInfo(parent, vars, local, composite, ConditionImpl.getInstance(ifc, unless)); }
final String attval = attr.getValue(); final String attvaltrim; if ("if".equals(attnm) && isZkElementAttr(langdef, attrns)) { ifc = attval; } else if ("unless".equals(attnm) && isZkElementAttr(langdef, attrns)) { unless = attval; } else if ("scope".equals(attnm) && isZkElementAttr(langdef, attrns)) { scope = attval; } else if ("composite".equals(attnm) && isZkElementAttr(langdef, attrns)) { composite = attval; } else if ("forEach".equals(attnm) && isZkElementAttr(langdef, attrns)) { throw new UiException(message("forEach not applicable to <custom-attributes>", el)); } else if (parent instanceof ComponentInfo && AnnotationHelper.isAnnotation(attvaltrim = attval.trim())) {