diff --git a/ChangeLog b/ChangeLog index 0a03faa9..c6d35d51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Dec 27 12:32:58 HKT 2003 William Brack + + * xmlschemas.c: added tests for xs:all to assure minOccurs + and maxOccurs <= 1 (Bug 130020) + Sat Dec 27 09:53:06 HKT 2003 William Brack * xmlregexp.c: fixed xmlFAParseCharRange for Unicode ranges diff --git a/xmlschemas.c b/xmlschemas.c index 303566ee..60a5bce5 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -2563,7 +2563,13 @@ xmlSchemaParseAll(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->type = XML_SCHEMA_TYPE_ALL; type->id = xmlSchemaGetProp(ctxt, node, "id"); type->minOccurs = xmlGetMinOccurs(ctxt, node); + if (type->minOccurs > 1) + xmlSchemaPErr(ctxt, node, XML_SCHEMAP_INVALID_MINOCCURS, + "invalid value for minOccurs (must be 0 or 1)\n", NULL, NULL); type->maxOccurs = xmlGetMaxOccurs(ctxt, node); + if (type->maxOccurs > 1) + xmlSchemaPErr(ctxt, node, XML_SCHEMAP_INVALID_MAXOCCURS, + "invalid value for maxOccurs (must be 0 or 1)\n", NULL, NULL); child = node->children; if (IS_SCHEMA(child, "annotation")) { @@ -2574,6 +2580,14 @@ xmlSchemaParseAll(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, subtype = (xmlSchemaTypePtr) xmlSchemaParseElement(ctxt, schema, child, 0); if (subtype != NULL) { + if (subtype->minOccurs > 1) + xmlSchemaPErr(ctxt, child, XML_SCHEMAP_INVALID_MINOCCURS, + "invalid value for minOccurs (must be 0 or 1)\n", + NULL, NULL); + if (subtype->maxOccurs > 1) + xmlSchemaPErr(ctxt, child, XML_SCHEMAP_INVALID_MAXOCCURS, + "invalid value for maxOccurs (must be 0 or 1)\n", + NULL, NULL); if (last == NULL) { type->subtypes = subtype; last = subtype;