1 61 62 63 64 package org.jaxen.expr; 65 66 import java.util.List ; 67 68 import org.jaxen.Context; 69 import org.jaxen.JaxenException; 70 71 public class DefaultXPathExpr implements XPathExpr 72 { 73 private Expr rootExpr; 74 75 public DefaultXPathExpr(Expr rootExpr) 76 { 77 this.rootExpr = rootExpr; 78 } 79 80 public Expr getRootExpr() 81 { 82 return this.rootExpr; 83 } 84 85 public void setRootExpr(Expr rootExpr) 86 { 87 this.rootExpr = rootExpr; 88 } 89 90 public String toString() 91 { 92 return "[(DefaultXPath): " + getRootExpr() + "]"; 93 } 94 95 public String getText() 96 { 97 return getRootExpr().getText(); 98 } 99 100 public void simplify() 101 { 102 setRootExpr( getRootExpr().simplify() ); 103 } 104 105 public List asList(Context context) throws JaxenException 106 { 107 Expr expr = getRootExpr(); 108 Object value = expr.evaluate( context ); 109 List result = DefaultExpr.convertToList( value ); 110 return result; 111 } 112 } 113 | Popular Tags |