1 16 17 package org.apache.cocoon.taglib.jxpath.core; 18 19 import org.apache.cocoon.taglib.IterationTag; 20 import org.apache.cocoon.taglib.core.ForEachSupport; 21 import org.apache.cocoon.taglib.core.LoopTag; 22 23 import org.xml.sax.Attributes ; 24 import org.xml.sax.SAXException ; 25 26 36 public class ForEachTag extends ForEachSupport implements LoopTag, IterationTag { 37 38 41 private String begin_; private String end_; private String step_; private String items_; 46 49 public ForEachTag() { 50 super(); 51 init(); 52 } 53 54 57 58 public int doStartTag(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { 59 60 evaluateExpressions(); 62 63 return super.doStartTag(namespaceURI, localName, qName, atts); 65 } 66 67 public void recycle() { 69 init(); 70 super.recycle(); 71 72 } 73 74 77 public void setBegin(String begin_) { 79 this.begin_ = begin_; 80 this.beginSpecified = true; 81 } 82 83 public void setEnd(String end_) { 85 this.end_ = end_; 86 this.endSpecified = true; 87 } 88 89 public void setStep(String step_) { 91 this.step_ = step_; 92 this.stepSpecified = true; 93 } 94 95 public void setItems(String items_) { 96 this.items_ = items_; 97 } 98 99 102 private void init() { 104 begin_ = null; end_ = null; step_ = null; items_ = null; } 110 111 112 private void evaluateExpressions() throws SAXException { 113 114 if (begin_ != null) { 115 begin = Integer.parseInt(begin_); 116 } 117 if (end_ != null) { 118 end = Integer.parseInt(end_); 119 } 120 if (step_ != null) { 121 step = Integer.parseInt(step_); 122 } 123 if (items_ != null) { 124 rawItems = getVariable(items_); 125 } 126 127 134 166 } 167 } 168 | Popular Tags |