1 17 package org.alfresco.repo.search.impl.lucene; 18 19 import org.saxpath.Axis; 20 import org.saxpath.SAXPathException; 21 import org.saxpath.XPathHandler; 22 23 import com.werken.saxpath.XPathReader; 24 25 public class DebugXPathHandler implements XPathHandler 26 { 27 28 public DebugXPathHandler() 29 { 30 super(); 31 } 33 34 public void endAbsoluteLocationPath() throws SAXPathException 35 { 36 System.out.println("End Absolute Location Path"); 37 } 38 39 public void endAdditiveExpr(int arg0) throws SAXPathException 40 { 41 System.out.println("End Additive Expr: value = " + arg0); 42 } 43 44 public void endAllNodeStep() throws SAXPathException 45 { 46 System.out.println("End All Node Step"); 47 } 48 49 public void endAndExpr(boolean arg0) throws SAXPathException 50 { 51 System.out.println("End And Expr: value = " + arg0); 52 } 53 54 public void endCommentNodeStep() throws SAXPathException 55 { 56 System.out.println("End Comment Node Step"); 57 } 58 59 public void endEqualityExpr(int arg0) throws SAXPathException 60 { 61 System.out.println("End Equality Expr: value = " + arg0); 62 } 63 64 public void endFilterExpr() throws SAXPathException 65 { 66 System.out.println("End Filter Expr"); 67 } 68 69 public void endFunction() throws SAXPathException 70 { 71 System.out.println("End Function"); 72 } 73 74 public void endMultiplicativeExpr(int arg0) throws SAXPathException 75 { 76 System.out.println("End Multiplicative Expr: value = " + arg0); 77 } 78 79 public void endNameStep() throws SAXPathException 80 { 81 System.out.println("End Name Step"); 82 } 83 84 public void endOrExpr(boolean arg0) throws SAXPathException 85 { 86 System.out.println("End Or Expr: value = " + arg0); 87 } 88 89 public void endPathExpr() throws SAXPathException 90 { 91 System.out.println("End Path Expression"); 92 } 93 94 public void endPredicate() throws SAXPathException 95 { 96 System.out.println("End Predicate"); 97 } 98 99 public void endProcessingInstructionNodeStep() throws SAXPathException 100 { 101 System.out.println("End Processing Instruction Node Step"); 102 } 103 104 public void endRelationalExpr(int arg0) throws SAXPathException 105 { 106 System.out.println("End Relational Expr: value = " + arg0); 107 } 108 109 public void endRelativeLocationPath() throws SAXPathException 110 { 111 System.out.println("End Relative Location Path"); 112 } 113 114 public void endTextNodeStep() throws SAXPathException 115 { 116 System.out.println("End Text Node Step"); 117 } 118 119 public void endUnaryExpr(int arg0) throws SAXPathException 120 { 121 System.out.println("End Unary Expr: value = " + arg0); 122 } 123 124 public void endUnionExpr(boolean arg0) throws SAXPathException 125 { 126 System.out.println("End Union Expr: value = " + arg0); 127 } 128 129 public void endXPath() throws SAXPathException 130 { 131 System.out.println("End XPath"); 132 } 133 134 public void literal(String arg0) throws SAXPathException 135 { 136 System.out.println("Literal = " + arg0); 137 } 138 139 public void number(double arg0) throws SAXPathException 140 { 141 System.out.println("Double = " + arg0); 142 } 143 144 public void number(int arg0) throws SAXPathException 145 { 146 System.out.println("Integer = " + arg0); 147 } 148 149 public void startAbsoluteLocationPath() throws SAXPathException 150 { 151 System.out.println("Start Absolute Location Path"); 152 } 153 154 public void startAdditiveExpr() throws SAXPathException 155 { 156 System.out.println("Start Additive Expression"); 157 } 158 159 public void startAllNodeStep(int arg0) throws SAXPathException 160 { 161 System.out.println("Start All Node Exp: Axis = " + Axis.lookup(arg0)); 162 } 163 164 public void startAndExpr() throws SAXPathException 165 { 166 System.out.println("Start AndExpression"); 167 } 168 169 public void startCommentNodeStep(int arg0) throws SAXPathException 170 { 171 System.out.println("Start Comment Node Step"); 172 } 173 174 public void startEqualityExpr() throws SAXPathException 175 { 176 System.out.println("Start Equality Expression"); 177 } 178 179 public void startFilterExpr() throws SAXPathException 180 { 181 System.out.println("Start Filter Expression"); 182 } 183 184 public void startFunction(String arg0, String arg1) throws SAXPathException 185 { 186 System.out.println("Start Function arg0 = < " + arg0 + " > arg1 = < " + arg1 + " >"); 187 } 188 189 public void startMultiplicativeExpr() throws SAXPathException 190 { 191 System.out.println("Start Multiplicative Expression"); 192 } 193 194 public void startNameStep(int arg0, String arg1, String arg2) throws SAXPathException 195 { 196 System.out.println("Start Name Step Axis = <" + Axis.lookup(arg0) + " > arg1 = < " + arg1 + " > arg 2 <" + arg2 197 + " >"); 198 } 199 200 public void startOrExpr() throws SAXPathException 201 { 202 System.out.println("Start Or Expression"); 203 } 204 205 public void startPathExpr() throws SAXPathException 206 { 207 System.out.println("Start Path Expression"); 208 } 209 210 public void startPredicate() throws SAXPathException 211 { 212 System.out.println("Start Predicate"); 213 } 214 215 public void startProcessingInstructionNodeStep(int arg0, String arg1) throws SAXPathException 216 { 217 System.out.println("Start Processing INstruction Node Step = < " + arg0 + " > arg1 = < " + arg1 + " >"); 218 } 219 220 public void startRelationalExpr() throws SAXPathException 221 { 222 System.out.println("Start Relationship Expression"); 223 } 224 225 public void startRelativeLocationPath() throws SAXPathException 226 { 227 System.out.println("Start Relative Location Path"); 228 } 229 230 public void startTextNodeStep(int arg0) throws SAXPathException 231 { 232 System.out.println("Start Text Node Step: value = " + arg0); 233 } 234 235 public void startUnaryExpr() throws SAXPathException 236 { 237 System.out.println("Start Unary Expression"); 238 } 239 240 public void startUnionExpr() throws SAXPathException 241 { 242 System.out.println("Start Union Expression"); 243 } 244 245 public void startXPath() throws SAXPathException 246 { 247 System.out.println("Start XPath"); 248 } 249 250 public void variableReference(String arg0, String arg1) throws SAXPathException 251 { 252 System.out.println("Variable Reference arg0 = < " + arg0 + " > arg1 = < " + arg1); 253 } 254 255 259 public static void main(String [] args) throws SAXPathException 260 { 261 XPathReader reader = new XPathReader(); 262 reader.setXPathHandler(new DebugXPathHandler()); 263 reader 264 .parse("/ns:one[@woof='dog']/two/./../two[functionTest(@a, @b, $woof:woof)]/three/*/four//*/five/six[@exists1 and @exists2]"); 265 } 266 267 } 268 | Popular Tags |