mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
Big XPath cleanup continues, one URI fix:
- xpath.[ch] debugXML.c testXPath.c: fixed the XPath evaluation engine, should be far more stable, incorporated a new version of preceding/following axis, need testing - uri.c: fixed file:///c:/a/b/c problem - test/XPath/tests/idsimple: augmented the XPath tests Daniel
This commit is contained in:
31
debugXML.c
31
debugXML.c
@ -1649,9 +1649,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
ctxt->pctxt->nodelist = xmlXPathNodeSetCreate(ctxt->node);
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
|
||||
#else
|
||||
list = NULL;
|
||||
@ -1688,21 +1686,14 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
fprintf(stderr, "%s: no such node\n", arg);
|
||||
}
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
ctxt->pctxt->nodelist = NULL;
|
||||
ctxt->pctxt->node = NULL;
|
||||
}
|
||||
} else if (!strcmp(command, "cd")) {
|
||||
if (arg[0] == 0) {
|
||||
ctxt->node = (xmlNodePtr) ctxt->doc;
|
||||
} else {
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
ctxt->pctxt->nodelist = xmlXPathNodeSetCreate(ctxt->node);
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
|
||||
#else
|
||||
list = NULL;
|
||||
@ -1733,11 +1724,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
fprintf(stderr, "%s: no such node\n", arg);
|
||||
}
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
ctxt->pctxt->nodelist = NULL;
|
||||
ctxt->pctxt->node = NULL;
|
||||
}
|
||||
} else if (!strcmp(command, "cat")) {
|
||||
if (arg[0] == 0) {
|
||||
@ -1745,9 +1732,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
ctxt->pctxt->nodelist = xmlXPathNodeSetCreate(ctxt->node);
|
||||
ctxt->pctxt->node = ctxt->node;
|
||||
list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
|
||||
#else
|
||||
list = NULL;
|
||||
@ -1781,11 +1766,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
} else {
|
||||
fprintf(stderr, "%s: no such node\n", arg);
|
||||
}
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
if (ctxt->pctxt->nodelist != NULL)
|
||||
xmlXPathFreeNodeSet(ctxt->pctxt->nodelist);
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
ctxt->pctxt->nodelist = NULL;
|
||||
ctxt->pctxt->node = NULL;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Unknown command %s\n", command);
|
||||
|
Reference in New Issue
Block a user