[libxml2] 571271 fix semantic of xsd:all with minOccurs=0
- From: Daniel Veillard <veillard src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libxml2] 571271 fix semantic of xsd:all with minOccurs=0
- Date: Wed, 12 Aug 2009 13:42:39 +0000 (UTC)
commit bd56c44349d9e14ed54e77b2706d0f92d1a1f994
Author: Daniel Veillard <veillard redhat com>
Date: Wed Aug 12 15:39:23 2009 +0200
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
result/schemas/all_1_3 | 2 +-
result/schemas/all_1_3.err | 1 +
result/schemas/all_1_6 | 2 +-
result/schemas/all_1_6.err | 1 +
result/schemas/all_1_7 | 2 +-
result/schemas/all_1_7.err | 1 +
xmlschemas.c | 14 +++++++++-----
7 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/result/schemas/all_1_3 b/result/schemas/all_1_3
index 8186e82..55a2a4d 100644
--- a/result/schemas/all_1_3
+++ b/result/schemas/all_1_3
@@ -1 +1 @@
-./test/schemas/all_3.xml validates
+./test/schemas/all_3.xml fails to validate
diff --git a/result/schemas/all_1_3.err b/result/schemas/all_1_3.err
index e69de29..6933fb7 100644
--- a/result/schemas/all_1_3.err
+++ b/result/schemas/all_1_3.err
@@ -0,0 +1 @@
+./test/schemas/all_3.xml:1: element doc: Schemas validity error : Element 'doc': Missing child element(s). Expected is ( c ).
diff --git a/result/schemas/all_1_6 b/result/schemas/all_1_6
index d4a9594..c3705c7 100644
--- a/result/schemas/all_1_6
+++ b/result/schemas/all_1_6
@@ -1 +1 @@
-./test/schemas/all_6.xml validates
+./test/schemas/all_6.xml fails to validate
diff --git a/result/schemas/all_1_6.err b/result/schemas/all_1_6.err
index e69de29..c31d91b 100644
--- a/result/schemas/all_1_6.err
+++ b/result/schemas/all_1_6.err
@@ -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 ).
diff --git a/result/schemas/all_1_7 b/result/schemas/all_1_7
index 6ad4fc6..d144d2d 100644
--- a/result/schemas/all_1_7
+++ b/result/schemas/all_1_7
@@ -1 +1 @@
-./test/schemas/all_7.xml validates
+./test/schemas/all_7.xml fails to validate
diff --git a/result/schemas/all_1_7.err b/result/schemas/all_1_7.err
index e69de29..d5c5428 100644
--- a/result/schemas/all_1_7.err
+++ b/result/schemas/all_1_7.err
@@ -0,0 +1 @@
+./test/schemas/all_7.xml:1: element doc: Schemas validity error : Element 'doc': Missing child element(s). Expected is ( c ).
diff --git a/xmlschemas.c b/xmlschemas.c
index d3fe98a..96d55b8 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]