Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * testXPath.c : a small tester program for XPath. |
| 3 | * |
| 4 | * See Copyright for the status of this software. |
| 5 | * |
| 6 | * Daniel.Veillard@w3.org |
| 7 | */ |
| 8 | |
| 9 | #ifdef WIN32 |
Daniel Veillard | 3c558c3 | 1999-12-22 11:30:41 +0000 | [diff] [blame] | 10 | #include "win32config.h" |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 11 | #else |
Daniel Veillard | 7f7d111 | 1999-09-22 09:46:25 +0000 | [diff] [blame] | 12 | #include "config.h" |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 13 | #endif |
Daniel Veillard | 7f7d111 | 1999-09-22 09:46:25 +0000 | [diff] [blame] | 14 | |
Daniel Veillard | 361d845 | 2000-04-03 19:48:13 +0000 | [diff] [blame] | 15 | #include "xmlversion.h" |
| 16 | #if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED) |
| 17 | |
Daniel Veillard | 7f7d111 | 1999-09-22 09:46:25 +0000 | [diff] [blame] | 18 | #include <stdio.h> |
| 19 | #include <string.h> |
| 20 | |
| 21 | #ifdef HAVE_SYS_TYPES_H |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 22 | #include <sys/types.h> |
Daniel Veillard | 7f7d111 | 1999-09-22 09:46:25 +0000 | [diff] [blame] | 23 | #endif |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 24 | #ifdef HAVE_SYS_STAT_H |
| 25 | #include <sys/stat.h> |
| 26 | #endif |
| 27 | #ifdef HAVE_FCNTL_H |
| 28 | #include <fcntl.h> |
| 29 | #endif |
| 30 | #ifdef HAVE_UNISTD_H |
| 31 | #include <unistd.h> |
| 32 | #endif |
Daniel Veillard | 7f7d111 | 1999-09-22 09:46:25 +0000 | [diff] [blame] | 33 | #ifdef HAVE_STDLIB_H |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 34 | #include <stdlib.h> |
Daniel Veillard | 7f7d111 | 1999-09-22 09:46:25 +0000 | [diff] [blame] | 35 | #endif |
| 36 | |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 37 | |
Daniel Veillard | 361d845 | 2000-04-03 19:48:13 +0000 | [diff] [blame] | 38 | #include <libxml/xpath.h> |
| 39 | #include <libxml/tree.h> |
| 40 | #include <libxml/parser.h> |
| 41 | #include <libxml/debugXML.h> |
| 42 | #include <libxml/xmlmemory.h> |
Daniel Veillard | 740abf5 | 2000-10-02 23:04:54 +0000 | [diff] [blame] | 43 | #include <libxml/parserInternals.h> |
Daniel Veillard | ac26030 | 2000-10-04 13:33:43 +0000 | [diff] [blame] | 44 | #if defined(LIBXML_XPTR_ENABLED) |
| 45 | #include <libxml/xpointer.h> |
| 46 | static int xptr = 0; |
| 47 | #endif |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 48 | static int debug = 0; |
Daniel Veillard | 740abf5 | 2000-10-02 23:04:54 +0000 | [diff] [blame] | 49 | static int valid = 0; |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 50 | static int expr = 0; |
| 51 | static xmlDocPtr document = NULL; |
| 52 | |
| 53 | /* |
| 54 | * Default document |
| 55 | */ |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 56 | static xmlChar buffer[] = |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 57 | "<?xml version=\"1.0\"?>\n\ |
| 58 | <EXAMPLE prop1=\"gnome is great\" prop2=\"& linux too\">\n\ |
| 59 | <head>\n\ |
| 60 | <title>Welcome to Gnome</title>\n\ |
| 61 | </head>\n\ |
| 62 | <chapter>\n\ |
| 63 | <title>The Linux adventure</title>\n\ |
| 64 | <p>bla bla bla ...</p>\n\ |
| 65 | <image href=\"linus.gif\"/>\n\ |
| 66 | <p>...</p>\n\ |
| 67 | </chapter>\n\ |
| 68 | <chapter>\n\ |
| 69 | <title>Chapter 2</title>\n\ |
| 70 | <p>this is chapter 2 ...</p>\n\ |
| 71 | </chapter>\n\ |
| 72 | <chapter>\n\ |
| 73 | <title>Chapter 3</title>\n\ |
| 74 | <p>this is chapter 3 ...</p>\n\ |
| 75 | </chapter>\n\ |
| 76 | <chapter>\n\ |
| 77 | <title>Chapter 4</title>\n\ |
| 78 | <p>this is chapter 4 ...</p>\n\ |
| 79 | </chapter>\n\ |
| 80 | <chapter>\n\ |
| 81 | <title>Chapter 5</title>\n\ |
| 82 | <p>this is chapter 5 ...</p>\n\ |
| 83 | </chapter>\n\ |
| 84 | </EXAMPLE>\n\ |
| 85 | "; |
| 86 | |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 87 | void xmlXPAthDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) { |
| 88 | int i; |
| 89 | char shift[100]; |
| 90 | |
| 91 | for (i = 0;((i < depth) && (i < 25));i++) |
| 92 | shift[2 * i] = shift[2 * i + 1] = ' '; |
| 93 | shift[2 * i] = shift[2 * i + 1] = 0; |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 94 | if (cur == NULL) { |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 95 | fprintf(output, shift); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 96 | fprintf(output, "Node is NULL !\n"); |
| 97 | return; |
| 98 | |
| 99 | } |
| 100 | |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 101 | if ((cur->type == XML_DOCUMENT_NODE) || |
| 102 | (cur->type == XML_HTML_DOCUMENT_NODE)) { |
| 103 | fprintf(output, shift); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 104 | fprintf(output, " /\n"); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 105 | } else if (cur->type == XML_ATTRIBUTE_NODE) |
| 106 | xmlDebugDumpAttr(output, (xmlAttrPtr)cur, depth); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 107 | else |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 108 | xmlDebugDumpOneNode(output, cur, depth); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 111 | void xmlXPAthDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) { |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 112 | int i; |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 113 | char shift[100]; |
| 114 | |
| 115 | for (i = 0;((i < depth) && (i < 25));i++) |
| 116 | shift[2 * i] = shift[2 * i + 1] = ' '; |
| 117 | shift[2 * i] = shift[2 * i + 1] = 0; |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 118 | |
| 119 | if (cur == NULL) { |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 120 | fprintf(output, shift); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 121 | fprintf(output, "NodeSet is NULL !\n"); |
| 122 | return; |
| 123 | |
| 124 | } |
| 125 | |
| 126 | fprintf(output, "Set contains %d nodes:\n", cur->nodeNr); |
| 127 | for (i = 0;i < cur->nodeNr;i++) { |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 128 | fprintf(output, shift); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 129 | fprintf(output, "%d", i + 1); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 130 | xmlXPAthDebugDumpNode(output, cur->nodeTab[i], depth + 1); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 134 | #if defined(LIBXML_XPTR_ENABLED) |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 135 | void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth); |
| 136 | void xmlXPAthDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) { |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 137 | int i; |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 138 | char shift[100]; |
| 139 | |
| 140 | for (i = 0;((i < depth) && (i < 25));i++) |
| 141 | shift[2 * i] = shift[2 * i + 1] = ' '; |
| 142 | shift[2 * i] = shift[2 * i + 1] = 0; |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 143 | |
| 144 | if (cur == NULL) { |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 145 | fprintf(output, shift); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 146 | fprintf(output, "LocationSet is NULL !\n"); |
| 147 | return; |
| 148 | |
| 149 | } |
| 150 | |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 151 | for (i = 0;i < cur->locNr;i++) { |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 152 | fprintf(output, shift); |
| 153 | fprintf(output, "%d :\n", i + 1); |
| 154 | xmlXPAthDebugDumpObject(output, cur->locTab[i], depth + 1); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 155 | } |
| 156 | } |
| 157 | #endif |
| 158 | |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 159 | void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { |
| 160 | int i; |
| 161 | char shift[100]; |
| 162 | |
| 163 | for (i = 0;((i < depth) && (i < 25));i++) |
| 164 | shift[2 * i] = shift[2 * i + 1] = ' '; |
| 165 | shift[2 * i] = shift[2 * i + 1] = 0; |
| 166 | |
| 167 | fprintf(output, shift); |
| 168 | |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 169 | if (cur == NULL) { |
| 170 | fprintf(output, "Object is empty (NULL)\n"); |
| 171 | return; |
| 172 | } |
| 173 | switch(cur->type) { |
| 174 | case XPATH_UNDEFINED: |
| 175 | fprintf(output, "Object is uninitialized\n"); |
| 176 | break; |
| 177 | case XPATH_NODESET: |
| 178 | fprintf(output, "Object is a Node Set :\n"); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 179 | xmlXPAthDebugDumpNodeSet(output, cur->nodesetval, depth); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 180 | break; |
| 181 | case XPATH_BOOLEAN: |
| 182 | fprintf(output, "Object is a Boolean : "); |
| 183 | if (cur->boolval) fprintf(output, "true\n"); |
| 184 | else fprintf(output, "false\n"); |
| 185 | break; |
| 186 | case XPATH_NUMBER: |
| 187 | fprintf(output, "Object is a number : %0g\n", cur->floatval); |
| 188 | break; |
| 189 | case XPATH_STRING: |
| 190 | fprintf(output, "Object is a string : "); |
| 191 | xmlDebugDumpString(output, cur->stringval); |
| 192 | fprintf(output, "\n"); |
| 193 | break; |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 194 | case XPATH_POINT: |
| 195 | fprintf(output, "Object is a point : index %d in node", cur->index); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 196 | xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 197 | fprintf(output, "\n"); |
| 198 | break; |
| 199 | case XPATH_RANGE: |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 200 | fprintf(output, "Object is a range : from "); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 201 | if (cur->index >= 0) |
| 202 | fprintf(output, "index %d in ", cur->index); |
| 203 | fprintf(output, "node"); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 204 | xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1); |
| 205 | fprintf(output, shift); |
| 206 | fprintf(output, " to "); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 207 | if (cur->index2 >= 0) |
| 208 | fprintf(output, "index %d in ", cur->index2); |
| 209 | fprintf(output, "node"); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 210 | xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user2, depth + 1); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 211 | fprintf(output, "\n"); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 212 | break; |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 213 | case XPATH_LOCATIONSET: |
| 214 | #if defined(LIBXML_XPTR_ENABLED) |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 215 | fprintf(output, "Object is a Location Set:\n"); |
| 216 | xmlXPAthDebugDumpLocationSet(output, |
| 217 | (xmlLocationSetPtr) cur->user, depth); |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 218 | #endif |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 219 | break; |
Daniel Veillard | 55b91f2 | 2000-10-05 16:30:11 +0000 | [diff] [blame] | 220 | case XPATH_USERS: |
| 221 | fprintf(output, "Object is user defined\n"); |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 222 | break; |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 223 | } |
| 224 | } |
| 225 | |
| 226 | void testXPath(const char *str) { |
| 227 | xmlXPathObjectPtr res; |
| 228 | xmlXPathContextPtr ctxt; |
| 229 | |
Daniel Veillard | ac26030 | 2000-10-04 13:33:43 +0000 | [diff] [blame] | 230 | #if defined(LIBXML_XPTR_ENABLED) |
| 231 | if (xptr) { |
| 232 | ctxt = xmlXPtrNewContext(document, NULL, NULL); |
| 233 | res = xmlXPtrEval(BAD_CAST str, ctxt); |
| 234 | } else { |
| 235 | #endif |
| 236 | ctxt = xmlXPathNewContext(document); |
| 237 | if (expr) |
| 238 | res = xmlXPathEvalExpression(BAD_CAST str, ctxt); |
| 239 | else |
| 240 | res = xmlXPathEval(BAD_CAST str, ctxt); |
| 241 | #if defined(LIBXML_XPTR_ENABLED) |
| 242 | } |
| 243 | #endif |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 244 | xmlXPAthDebugDumpObject(stdout, res, 0); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 245 | xmlXPathFreeObject(res); |
Daniel Veillard | e2d034d | 1999-07-27 19:52:06 +0000 | [diff] [blame] | 246 | xmlXPathFreeContext(ctxt); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | void testXPathFile(const char *filename) { |
| 250 | FILE *input; |
| 251 | char expr[5000]; |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 252 | int len; |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 253 | |
| 254 | input = fopen(filename, "r"); |
| 255 | if (input == NULL) { |
| 256 | fprintf(stderr, "Cannot open %s for reading\n", filename); |
| 257 | return; |
| 258 | } |
Daniel Veillard | 7e99c63 | 2000-10-06 12:59:53 +0000 | [diff] [blame^] | 259 | while (fgets(expr, 4500, input) != NULL) { |
| 260 | len = strlen(expr); |
| 261 | len--; |
| 262 | while ((len >= 0) && |
| 263 | ((expr[len] == '\n') || (expr[len] == '\t') || |
| 264 | (expr[len] == '\r') || (expr[len] == ' '))) len--; |
| 265 | expr[len + 1] = 0; |
| 266 | if (len >= 0) { |
| 267 | printf("\n========================\nExpression: %s\n", expr) ; |
| 268 | testXPath(expr); |
| 269 | } |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | fclose(input); |
| 273 | } |
| 274 | |
| 275 | int main(int argc, char **argv) { |
| 276 | int i; |
| 277 | int strings = 0; |
| 278 | int usefile = 0; |
| 279 | char *filename = NULL; |
| 280 | |
| 281 | for (i = 1; i < argc ; i++) { |
Daniel Veillard | ac26030 | 2000-10-04 13:33:43 +0000 | [diff] [blame] | 282 | #if defined(LIBXML_XPTR_ENABLED) |
| 283 | if ((!strcmp(argv[i], "-xptr")) || (!strcmp(argv[i], "--xptr"))) |
| 284 | xptr++; |
| 285 | #endif |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 286 | if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) |
| 287 | debug++; |
Daniel Veillard | 740abf5 | 2000-10-02 23:04:54 +0000 | [diff] [blame] | 288 | if ((!strcmp(argv[i], "-valid")) || (!strcmp(argv[i], "--valid"))) |
| 289 | valid++; |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 290 | if ((!strcmp(argv[i], "-expr")) || (!strcmp(argv[i], "--expr"))) |
| 291 | expr++; |
| 292 | if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input"))) |
| 293 | filename = argv[++i]; |
| 294 | if ((!strcmp(argv[i], "-f")) || (!strcmp(argv[i], "--file"))) |
| 295 | usefile++; |
| 296 | } |
Daniel Veillard | 740abf5 | 2000-10-02 23:04:54 +0000 | [diff] [blame] | 297 | if (valid != 0) xmlDoValidityCheckingDefaultValue = 1; |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 298 | if (document == NULL) { |
| 299 | if (filename == NULL) |
| 300 | document = xmlParseDoc(buffer); |
| 301 | else |
| 302 | document = xmlParseFile(filename); |
| 303 | } |
| 304 | for (i = 1; i < argc ; i++) { |
| 305 | if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input"))) { |
| 306 | i++; continue; |
| 307 | } |
| 308 | if (argv[i][0] != '-') { |
| 309 | if (usefile) |
| 310 | testXPathFile(argv[i]); |
| 311 | else |
| 312 | testXPath(argv[i]); |
| 313 | strings ++; |
| 314 | } |
| 315 | } |
| 316 | if (strings == 0) { |
| 317 | printf("Usage : %s [--debug] [--copy] stringsorfiles ...\n", |
| 318 | argv[0]); |
| 319 | printf("\tParse the XPath strings and output the result of the parsing\n"); |
| 320 | printf("\t--debug : dump a debug version of the result\n"); |
Daniel Veillard | 740abf5 | 2000-10-02 23:04:54 +0000 | [diff] [blame] | 321 | printf("\t--valid : switch on DTD support in the parser\n"); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 322 | printf("\t--expr : debug XPath expressions only\n"); |
| 323 | printf("\t--input filename : or\n"); |
| 324 | printf("\t-i filename : read the document from filename\n"); |
| 325 | printf("\t--file : or\n"); |
| 326 | printf("\t-f : read queries from files, args\n"); |
| 327 | } |
Daniel Veillard | f5c2c87 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 328 | if (document != NULL) |
| 329 | xmlFreeDoc(document); |
| 330 | xmlCleanupParser(); |
| 331 | xmlMemoryDump(); |
Daniel Veillard | 1566d3a | 1999-07-15 14:24:29 +0000 | [diff] [blame] | 332 | |
| 333 | return(0); |
| 334 | } |
Daniel Veillard | 361d845 | 2000-04-03 19:48:13 +0000 | [diff] [blame] | 335 | #else |
| 336 | #include <stdio.h> |
| 337 | int main(int argc, char **argv) { |
| 338 | printf("%s : XPath/Debug support not compiled in\n", argv[0]); |
| 339 | return(0); |
| 340 | } |
| 341 | #endif /* LIBXML_XPATH_ENABLED */ |