1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-28 07:21:26 +03:00

Fixed #312957 reported by Carol Hunter: streaming XPath states were not

* 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.
This commit is contained in:
Kasimier T. Buchcik 2005-08-09 12:31:55 +00:00
parent 6e65e15777
commit 800cbac34e
6 changed files with 91 additions and 1 deletions

View File

@ -1,3 +1,11 @@
Tue Aug 9 14:22:47 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* 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 <daniel@veillard.com>
* xmlregexp.c xmlschemas.c: trying to nail down the remaining

View File

@ -0,0 +1 @@
./test/schemas/bug312957_0.xml fails to validate

View File

@ -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'.

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<family xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="bug312957_1.xsd"
name="test">
<siblings>
<sibling name="gill"/>
</siblings>
<sisters>
<sister name="gill"/>
<sister name="annie"/>
</sisters>
</family>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="family" type="family_type">
<xs:key name="sibling_key">
<xs:selector xpath="siblings/sibling"/>
<xs:field xpath="@name"/>
</xs:key>
<xs:keyref name="sibling_key_ref" refer="sibling_key">
<xs:selector xpath="sisters/sister"/>
<xs:field xpath="@name"/>
</xs:keyref>
</xs:element>
<xs:complexType name="family_type">
<xs:sequence>
<xs:element name="siblings" type="siblings_type" />
<xs:element name="sisters" type="sisters_type" />
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
<xs:complexType name="siblings_type">
<xs:sequence>
<xs:element name="sibling" type="sibling_type" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sisters_type">
<xs:sequence>
<xs:element name="sister" type="sister_type" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sibling_type">
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
<xs:complexType name="sister_type">
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
</xs:schema>

View File

@ -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);
}
/*