- testXPath.c : added a --tree option allowing to display the
  tree dump of the XPath expression
Daniel
diff --git a/testXPath.c b/testXPath.c
index d7f2a97..424380b 100644
--- a/testXPath.c
+++ b/testXPath.c
@@ -50,6 +50,7 @@
 static int debug = 0;
 static int valid = 0;
 static int expr = 0;
+static int tree = 0;
 static xmlDocPtr document = NULL;
 
 /*
@@ -102,8 +103,19 @@
 	ctxt->node = xmlDocGetRootElement(document);
 	if (expr)
 	    res = xmlXPathEvalExpression(BAD_CAST str, ctxt);
-	else
-	    res = xmlXPathEval(BAD_CAST str, ctxt);
+	else {
+	    /* res = xmlXPathEval(BAD_CAST str, ctxt); */
+	    xmlXPathCompExprPtr comp;
+
+	    comp = xmlXPathCompile(BAD_CAST str);
+	    if (comp != NULL) {
+		if (tree) 
+		    xmlXPathDebugDumpCompExpr(stdout, comp, 0);
+
+		res = xmlXPathCompiledEval(comp, ctxt);
+	    } else
+		res = NULL;
+	}
 #if defined(LIBXML_XPTR_ENABLED)
     }
 #endif
@@ -157,6 +169,8 @@
 	    valid++;
 	if ((!strcmp(argv[i], "-expr")) || (!strcmp(argv[i], "--expr")))
 	    expr++;
+	if ((!strcmp(argv[i], "-tree")) || (!strcmp(argv[i], "--tree")))
+	    tree++;
 	if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input")))
 	    filename = argv[++i];
 	if ((!strcmp(argv[i], "-f")) || (!strcmp(argv[i], "--file")))
@@ -191,6 +205,7 @@
 	printf("\t--xptr : expressions are XPointer expressions\n");
 #endif
 	printf("\t--expr : debug XPath expressions only\n");
+	printf("\t--tree : show the compiled XPath tree\n");
 	printf("\t--input filename : or\n");
 	printf("\t-i filename      : read the document from filename\n");
 	printf("\t--file : or\n");