1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

Fix Schema determinism check of ##other namespaces

Non-compound (##local) and compound string atoms are always disjoint
regardless of whether the compound atom is negated (##other).

Closes #40.
This commit is contained in:
Nick Wellnhofer 2019-09-16 15:36:02 +02:00
parent 4e326a3aa9
commit e8c9cd5c7a
5 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1 @@
./test/schemas/issue40_0.xml validates

View File

View File

@ -0,0 +1,3 @@
<a:aaa xmlns:a="aaa_ns">
<x/>
</a:aaa>

View File

@ -0,0 +1,10 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="aaa_ns" xmlns="http://www.w3.org/1999/XSL/Transform">
<xsd:element name="aaa">
<xsd:complexType>
<xsd:choice>
<xsd:any namespace="##other" processContents="skip" />
<xsd:any namespace="##local" processContents="skip" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -2528,9 +2528,18 @@ xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2, int deep) {
case XML_REGEXP_STRING:
if (!deep)
ret = (atom1->valuep != atom2->valuep);
else
ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep,
(xmlChar *)atom2->valuep);
else {
xmlChar *val1 = (xmlChar *)atom1->valuep;
xmlChar *val2 = (xmlChar *)atom2->valuep;
int compound1 = (xmlStrchr(val1, '|') != NULL);
int compound2 = (xmlStrchr(val2, '|') != NULL);
/* Ignore negative match flag for ##other namespaces */
if (compound1 != compound2)
return(0);
ret = xmlRegStrEqualWildcard(val1, val2);
}
break;
case XML_REGEXP_EPSILON:
goto not_determinist;