mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
- testXPath.c xpath.c: fixing the XPath union expressions problem
reported by Martin Vidner <martin@artax.karlin.mff.cuni.cz> Daniel
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
Wed Jan 3 16:19:39 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* testXPath.c xpath.c: fixing the XPath union expressions problem
|
||||||
|
reported by Martin Vidner <martin@artax.karlin.mff.cuni.cz>
|
||||||
|
|
||||||
Wed Jan 3 14:22:33 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Wed Jan 3 14:22:33 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* xmllint.c: Made is so if the file name is "-" is will read form
|
* xmllint.c: Made is so if the file name is "-" is will read form
|
||||||
|
@ -98,6 +98,7 @@ void testXPath(const char *str) {
|
|||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
ctxt = xmlXPathNewContext(document);
|
ctxt = xmlXPathNewContext(document);
|
||||||
|
ctxt->node = xmlDocGetRootElement(document);
|
||||||
if (expr)
|
if (expr)
|
||||||
res = xmlXPathEvalExpression(BAD_CAST str, ctxt);
|
res = xmlXPathEvalExpression(BAD_CAST str, ctxt);
|
||||||
else
|
else
|
||||||
|
11
xpath.c
11
xpath.c
@ -4730,12 +4730,13 @@ xmlXPathEvalUnionExpr(xmlXPathParserContextPtr ctxt) {
|
|||||||
xmlXPathEvalPathExpr(ctxt);
|
xmlXPathEvalPathExpr(ctxt);
|
||||||
CHECK_ERROR;
|
CHECK_ERROR;
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
if (CUR == '|') {
|
while (CUR == '|') {
|
||||||
xmlXPathObjectPtr obj1,obj2;
|
xmlXPathObjectPtr obj1,obj2, tmp;
|
||||||
|
|
||||||
CHECK_TYPE(XPATH_NODESET);
|
CHECK_TYPE(XPATH_NODESET);
|
||||||
obj1 = valuePop(ctxt);
|
obj1 = valuePop(ctxt);
|
||||||
valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node));
|
tmp = xmlXPathNewNodeSet(ctxt->context->node);
|
||||||
|
valuePush(ctxt, tmp);
|
||||||
|
|
||||||
NEXT;
|
NEXT;
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
@ -4745,6 +4746,10 @@ xmlXPathEvalUnionExpr(xmlXPathParserContextPtr ctxt) {
|
|||||||
obj2 = valuePop(ctxt);
|
obj2 = valuePop(ctxt);
|
||||||
obj1->nodesetval = xmlXPathNodeSetMerge(obj1->nodesetval,
|
obj1->nodesetval = xmlXPathNodeSetMerge(obj1->nodesetval,
|
||||||
obj2->nodesetval);
|
obj2->nodesetval);
|
||||||
|
if (ctxt->value == tmp) {
|
||||||
|
tmp = valuePop(ctxt);
|
||||||
|
xmlXPathFreeObject(tmp);
|
||||||
|
}
|
||||||
valuePush(ctxt, obj1);
|
valuePush(ctxt, obj1);
|
||||||
xmlXPathFreeObject(obj2);
|
xmlXPathFreeObject(obj2);
|
||||||
SKIP_BLANKS;
|
SKIP_BLANKS;
|
||||||
|
Reference in New Issue
Block a user