mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
Fixed the XPointer crap ...
- xpath.c: fixed the XPointer problem introduced in 2.3.6 Daniel
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Sun Apr 22 21:11:45 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* xpath.c: fixed the XPointer problem introduced in 2.3.6
|
||||||
|
|
||||||
Sun Apr 22 14:11:58 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Sun Apr 22 14:11:58 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* tree.c: fixed #53388 with the provided patch
|
* tree.c: fixed #53388 with the provided patch
|
||||||
|
42
xpath.c
42
xpath.c
@ -779,6 +779,9 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
|
|||||||
case XPATH_OP_ARG: fprintf(output, "ARG"); break;
|
case XPATH_OP_ARG: fprintf(output, "ARG"); break;
|
||||||
case XPATH_OP_PREDICATE: fprintf(output, "PREDICATE"); break;
|
case XPATH_OP_PREDICATE: fprintf(output, "PREDICATE"); break;
|
||||||
case XPATH_OP_FILTER: fprintf(output, "FILTER"); break;
|
case XPATH_OP_FILTER: fprintf(output, "FILTER"); break;
|
||||||
|
#ifdef LIBXML_XPTR_ENABLED
|
||||||
|
case XPATH_OP_RANGETO: fprintf(output, "RANGETO"); break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
fprintf(output, "UNKNOWN %d\n", op->op); return;
|
fprintf(output, "UNKNOWN %d\n", op->op); return;
|
||||||
}
|
}
|
||||||
@ -6294,6 +6297,11 @@ xmlXPathIsAxisName(const xmlChar *name) {
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
|
xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
|
||||||
|
#ifdef LIBXML_XPTR_ENABLED
|
||||||
|
int rangeto = 0;
|
||||||
|
int op2 = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
if ((CUR == '.') && (NXT(1) == '.')) {
|
if ((CUR == '.') && (NXT(1) == '.')) {
|
||||||
SKIP(2);
|
SKIP(2);
|
||||||
@ -6318,7 +6326,7 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
|
|||||||
if (ctxt->xptr) {
|
if (ctxt->xptr) {
|
||||||
name = xmlXPathParseNCName(ctxt);
|
name = xmlXPathParseNCName(ctxt);
|
||||||
if ((name != NULL) && (xmlStrEqual(name, BAD_CAST "range-to"))) {
|
if ((name != NULL) && (xmlStrEqual(name, BAD_CAST "range-to"))) {
|
||||||
int op2 = ctxt->comp->last;
|
op2 = ctxt->comp->last;
|
||||||
xmlFree(name);
|
xmlFree(name);
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
if (CUR != '(') {
|
if (CUR != '(') {
|
||||||
@ -6328,7 +6336,7 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
|
|||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
|
|
||||||
xmlXPathCompileExpr(ctxt);
|
xmlXPathCompileExpr(ctxt);
|
||||||
PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, ctxt->comp->last, 0, 0);
|
/* PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, ctxt->comp->last, 0, 0); */
|
||||||
CHECK_ERROR;
|
CHECK_ERROR;
|
||||||
|
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
@ -6336,6 +6344,7 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
|
|||||||
XP_ERROR(XPATH_EXPR_ERROR);
|
XP_ERROR(XPATH_EXPR_ERROR);
|
||||||
}
|
}
|
||||||
NEXT;
|
NEXT;
|
||||||
|
rangeto = 1;
|
||||||
goto eval_predicates;
|
goto eval_predicates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6377,7 +6386,12 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
|
|||||||
|
|
||||||
#ifdef DEBUG_STEP
|
#ifdef DEBUG_STEP
|
||||||
xmlGenericError(xmlGenericErrorContext, "Basis : ");
|
xmlGenericError(xmlGenericErrorContext, "Basis : ");
|
||||||
xmlGenericErrorContextNodeSet(stdout, ctxt->value->nodesetval);
|
if (ctxt->value == NULL)
|
||||||
|
xmlGenericError(xmlGenericErrorContext, "no value\n");
|
||||||
|
else if (ctxt->value->nodesetval == NULL)
|
||||||
|
xmlGenericError(xmlGenericErrorContext, "Empty\n");
|
||||||
|
else
|
||||||
|
xmlGenericErrorContextNodeSet(stdout, ctxt->value->nodesetval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eval_predicates:
|
eval_predicates:
|
||||||
@ -6389,14 +6403,24 @@ eval_predicates:
|
|||||||
xmlXPathCompPredicate(ctxt, 0);
|
xmlXPathCompPredicate(ctxt, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PUSH_FULL_EXPR(XPATH_OP_COLLECT, op1, ctxt->comp->last, axis,
|
#ifdef LIBXML_XPTR_ENABLED
|
||||||
test, type, (void *)prefix, (void *)name);
|
if (rangeto) {
|
||||||
|
PUSH_BINARY_EXPR(XPATH_OP_RANGETO, op2, op1, 0, 0);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
PUSH_FULL_EXPR(XPATH_OP_COLLECT, op1, ctxt->comp->last, axis,
|
||||||
|
test, type, (void *)prefix, (void *)name);
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_STEP
|
#ifdef DEBUG_STEP
|
||||||
xmlGenericError(xmlGenericErrorContext, "Step : ");
|
xmlGenericError(xmlGenericErrorContext, "Step : ");
|
||||||
xmlGenericErrorContextNodeSet(xmlGenericErrorContext,
|
if (ctxt->value == NULL)
|
||||||
ctxt->value->nodesetval);
|
xmlGenericError(xmlGenericErrorContext, "no value\n");
|
||||||
|
else if (ctxt->value->nodesetval == NULL)
|
||||||
|
xmlGenericError(xmlGenericErrorContext, "Empty\n");
|
||||||
|
else
|
||||||
|
xmlGenericErrorContextNodeSet(xmlGenericErrorContext,
|
||||||
|
ctxt->value->nodesetval);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6643,10 +6667,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
|
|||||||
" context contains %d nodes\n",
|
" context contains %d nodes\n",
|
||||||
nodelist->nodeNr);
|
nodelist->nodeNr);
|
||||||
switch (test) {
|
switch (test) {
|
||||||
case NODE_TEST_NODE:
|
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
|
||||||
" searching all nodes\n");
|
|
||||||
break;
|
|
||||||
case NODE_TEST_NONE:
|
case NODE_TEST_NONE:
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
" searching for none !!!\n");
|
" searching for none !!!\n");
|
||||||
|
Reference in New Issue
Block a user