diff --git a/ChangeLog b/ChangeLog index bf37ae5b..aa8703ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Aug 9 14:22:47 CEST 2005 Kasimier Buchcik + + * xmlschemas.c: Fixed #312957 reported by Carol Hunter: + streaming XPath states were not popped in every case, + thus failed to resolve correctly for subsequent input. + * test/schemas/bug312957* result/schemas/bug312957*: + Added the test submitted by Carol Hunter. + Tue Aug 9 13:07:27 CEST 2005 Daniel Veillard * xmlregexp.c xmlschemas.c: trying to nail down the remaining diff --git a/result/schemas/bug312957_1_0 b/result/schemas/bug312957_1_0 new file mode 100644 index 00000000..1ec62695 --- /dev/null +++ b/result/schemas/bug312957_1_0 @@ -0,0 +1 @@ +./test/schemas/bug312957_0.xml fails to validate diff --git a/result/schemas/bug312957_1_0.err b/result/schemas/bug312957_1_0.err new file mode 100644 index 00000000..86173efe --- /dev/null +++ b/result/schemas/bug312957_1_0.err @@ -0,0 +1 @@ +./test/schemas/bug312957_0.xml:5: element family: Schemas validity error : Element 'family': No match found for key-sequence ['annie'] of key reference 'sibling_key_ref'. diff --git a/test/schemas/bug312957_0.xml b/test/schemas/bug312957_0.xml new file mode 100644 index 00000000..c22444f7 --- /dev/null +++ b/test/schemas/bug312957_0.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/test/schemas/bug312957_1.xsd b/test/schemas/bug312957_1.xsd new file mode 100644 index 00000000..fb7972ea --- /dev/null +++ b/test/schemas/bug312957_1.xsd @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xmlschemas.c b/xmlschemas.c index 7a016a25..1d2af17b 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -19133,6 +19133,32 @@ xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt, return (BAD_CAST *buf); } +/** + * xmlSchemaXPathPop: + * @vctxt: the WXS validation context + * + * Pops all XPath states. + * + * Returns 0 on success and -1 on internal errors. + */ +static int +xmlSchemaXPathPop(xmlSchemaValidCtxtPtr vctxt) +{ + xmlSchemaIDCStateObjPtr sto; + int res; + + if (vctxt->xpathStates == NULL) + return(0); + sto = vctxt->xpathStates; + do { + res = xmlStreamPop((xmlStreamCtxtPtr) sto->xpathCtxt); + if (res == -1) + return (-1); + sto = sto->next; + } while (sto != NULL); + return(0); +} + /** * xmlSchemaXPathProcessHistory: * @vctxt: the WXS validation context @@ -21793,7 +21819,8 @@ eval_idcs: "calling xmlSchemaXPathEvaluate()"); goto internal_error; } - } + } else if (vctxt->xpathStates != NULL) + xmlSchemaXPathPop(vctxt); } /*