1 16 package org.apache.cocoon.forms.binding; 17 18 import org.apache.cocoon.forms.util.DomHelper; 19 import org.w3c.dom.Element ; 20 21 33 public class SetAttributeJXPathBindingBuilder 34 extends JXPathBindingBuilderBase { 35 36 37 41 public JXPathBindingBase buildBinding(Element bindingElm, 42 JXPathBindingManager.Assistant assistant) throws BindingException { 43 44 try { 45 CommonAttributes commonAtts = 46 JXPathBindingBuilderBase.getCommonAttributes(bindingElm); 47 48 String attName = DomHelper.getAttribute(bindingElm, "name", null); 49 String attValue = DomHelper.getAttribute(bindingElm, "value", null); 50 51 SetAttributeJXPathBinding otherBinding = (SetAttributeJXPathBinding)assistant.getContext().getSuperBinding(); 53 if(otherBinding!=null) { 54 commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts); 55 56 if(attName==null) 57 attName = otherBinding.getId(); 58 if(attValue==null) 59 attValue = otherBinding.getValue(); 60 } 61 62 SetAttributeJXPathBinding attBinding = 63 new SetAttributeJXPathBinding(commonAtts, attName, attValue); 64 return attBinding; 65 } catch (BindingException e) { 66 throw e; 67 } catch (Exception e) { 68 throw new BindingException( 69 "Error building set-attribute binding defined at " + 70 DomHelper.getLocation(bindingElm), e); 71 } 72 } 73 } 74 | Popular Tags |