1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-29 21:46:59 +03:00

571271 fix semantic of xsd:all with minOccurs=0

* xmlschemas.c: apparently we though it allowed any of the sub elements
  to be missing, and probably not what's expected from the spec, though
  it used to forbid it c.f.:
  http://lists.xml.org/archives/xml-dev/200109/msg00512.html
  asking HT for confirmation but it's likely that we were wrong on the
  semantic
* result/schemas/all_1_[367]*: this changes the output of soem of our
  internal regression tests
This commit is contained in:
Daniel Veillard 2009-08-12 15:39:23 +02:00
parent be390ed0a1
commit bd56c44349
7 changed files with 15 additions and 8 deletions

View File

@ -1 +1 @@
./test/schemas/all_3.xml validates
./test/schemas/all_3.xml fails to validate

View File

@ -0,0 +1 @@
./test/schemas/all_3.xml:1: element doc: Schemas validity error : Element 'doc': Missing child element(s). Expected is ( c ).

View File

@ -1 +1 @@
./test/schemas/all_6.xml validates
./test/schemas/all_6.xml fails to validate

View File

@ -0,0 +1 @@
./test/schemas/all_6.xml:1: element doc: Schemas validity error : Element 'doc': Missing child element(s). Expected is one of ( b, c ).

View File

@ -1 +1 @@
./test/schemas/all_7.xml validates
./test/schemas/all_7.xml fails to validate

View File

@ -0,0 +1 @@
./test/schemas/all_7.xml:1: element doc: Schemas validity error : Element 'doc': Missing child element(s). Expected is ( c ).

View File

@ -12966,17 +12966,19 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
break;
}
case XML_SCHEMA_TYPE_ALL:{
xmlAutomataStatePtr start;
xmlAutomataStatePtr start, tmp;
xmlSchemaParticlePtr sub;
xmlSchemaElementPtr elemDecl;
int lax;
sub = (xmlSchemaParticlePtr) particle->children->children;
if (sub == NULL)
break;
start = pctxt->state;
tmp = xmlAutomataNewState(pctxt->am);
xmlAutomataNewEpsilon(pctxt->am, pctxt->state, tmp);
pctxt->state = tmp;
while (sub != NULL) {
pctxt->state = start;
pctxt->state = tmp;
elemDecl = (xmlSchemaElementPtr) sub->children;
if (elemDecl == NULL) {
@ -13024,9 +13026,11 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt,
}
sub = (xmlSchemaParticlePtr) sub->next;
}
lax = particle->minOccurs == 0;
pctxt->state =
xmlAutomataNewAllTrans(pctxt->am, pctxt->state, NULL, lax);
xmlAutomataNewAllTrans(pctxt->am, pctxt->state, NULL, 0);
if (particle->minOccurs == 0) {
xmlAutomataNewEpsilon(pctxt->am, start, pctxt->state);
}
break;
}
case XML_SCHEMA_TYPE_GROUP: