1 package com.openinventions.webappfilter.processor; 2 3 import com.openinventions.metaframework.*; 4 import org.apache.commons.logging.*; 5 import java.io.*; 6 import com.openinventions.webappfilter.processor.xpathexpression.*; 7 8 public class If implements Processor { 9 private static final Log log = LogFactory.getLog(If.class); 10 11 public void process(State state, Element context) throws Exception { 12 String test = context.getValue("@test"); 13 Boolean b = (Boolean ) new XPathExpressionParser(new StringReader(test)).parse(state); 14 if (log.isDebugEnabled()) { 15 log.debug("test = " + test); 16 log.debug("b = " + b); 17 } 18 if (b.booleanValue()) { 19 String nextCommand = (String ) state.get("nextCommand"); 20 if (log.isDebugEnabled()) { 21 log.debug("nextCommand = " + nextCommand); 22 } 23 state.set("nextCommand", nextCommand + "/child::*[1]"); 24 state.set("relativeCommand", "/following-sibling::*[1]"); 25 } 26 } 27 } 28 79 | Popular Tags |