aboutsummaryrefslogtreecommitdiffstats
path: root/debugXML.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-01-22 22:12:19 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-01-22 22:12:19 +0000
commit2070c48cdc2809b1676386d3eea6bc8050347748 (patch)
treebb2d05fa459dead80aa48d26541c83ec909c8e8c /debugXML.c
parent5e926fa77ed2539ae9f2376cca81fe9c564e06f1 (diff)
downloadandroid_external_libxml2-2070c48cdc2809b1676386d3eea6bc8050347748.tar.gz
android_external_libxml2-2070c48cdc2809b1676386d3eea6bc8050347748.tar.bz2
android_external_libxml2-2070c48cdc2809b1676386d3eea6bc8050347748.zip
added an xpath function to the shell for T. V. Raman Daniel
* debugXML.c: added an xpath function to the shell for T. V. Raman Daniel
Diffstat (limited to 'debugXML.c')
-rw-r--r--debugXML.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/debugXML.c b/debugXML.c
index 66b69a2c..41dd37fb 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -2048,6 +2048,9 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
fprintf(stdout, "\tfree display memory usage\n");
fprintf(stdout, "\tload [name] load a new document with name\n");
fprintf(stdout, "\tls [path] list contents of path or the current directory\n");
+#ifdef LIBXML_XPATH_ENABLED
+ fprintf(stdout, "\txpath expr evaluate the XPath expression in that context and print the result\n");
+#endif /* LIBXML_XPATH_ENABLED */
fprintf(stdout, "\tpwd display current working directory\n");
fprintf(stdout, "\tquit leave shell\n");
fprintf(stdout, "\tsave [name] save this document to name or the original name\n");
@@ -2079,6 +2082,18 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
xmlShellDu(ctxt, NULL, ctxt->node, NULL);
} else if (!strcmp(command, "base")) {
xmlShellBase(ctxt, NULL, ctxt->node, NULL);
+#ifdef LIBXML_XPATH_ENABLED
+ } else if (!strcmp(command, "xpath")) {
+ if (arg[0] == 0) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xpath: expression required\n");
+ } else {
+ ctxt->pctxt->node = ctxt->node;
+ list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
+ xmlXPathDebugDumpObject(stdout, list, 0);
+ xmlXPathFreeObject(list);
+ }
+#endif /* LIBXML_XPATH_ENABLED */
} else if (!strcmp(command, "setbase")) {
xmlShellSetBase(ctxt, arg, ctxt->node, NULL);
} else if ((!strcmp(command, "ls")) || (!strcmp(command, "dir"))) {