1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

modified parsing of <list>, <union>, <restriction>, <sequence>, <choice>,

* xmlschemas.c: modified parsing of <list>, <union>, <restriction>,
  <sequence>, <choice>, <include>, <import>.
  Fixed schema defaults (elementFormDefault, etc.) for included
  schemas.
  Fixed a bug which reported attributes as invalid on
  elements declarations with the built-in type 'anyType'.
  Added "lax" validation of the content of elements of type
  'anyType'.
  Fixed: element declarations with the same name were treated
  as duplicate if located in the subtree of <choice> -> <sequence>.
  (This was bug 150623, submitted by Roland Lezuo)
  Fixed cleanup of error codes in xmlSchemaValidateDoc as proposed
  by Igor Kapitanker. (This was bug 150647, submitted by Igor
  Kapitanker)
* xmlschemastypes.c: Changed the type of anyType to
  XML_SCHEMAS_ANYTYPE.
* include/libxml/xmlerror.h: Added schema parser errors.
* result/schemas/bug145246_0_0*
  result/schemas/extension1_0_2.err: Changed test results.
* result/schemas/ct-sc-nobase_0_0*
  result/schemas/facet-whiteSpace_0_0*
  result/schemas/import1_0_0* result/schemas/import2_0_0*
  result/schemas/include2_0_0* result/schemas/include3_0_0*
  result/schemas/restriction-attr1_0_0*
  result/schemas/seq-dubl-elem1_0_0*
  result/schemas/xsd-list-itemType_0_0*: Added new rest results.
  test/schemas/bug145246.xsd.imp test/schemas/ct-sc-nobase_0*
  test/schemas/facet-whiteSpace_0* test/schemas/import1_0*
  test/schemas/import2_0* test/schemas/include2_0*
  test/schemas/include3_0* test/schemas/restriction-attr1_0*
  test/schemas/seq-dubl-elem1_0* test/schemas/xml.xsd
  test/schemas/xsd-list-itemType_0*: Added new tests and missing
  files.
This commit is contained in:
William M. Brack
2004-08-20 23:09:47 +00:00
parent dab93ea749
commit 2f2a66324d
51 changed files with 2555 additions and 956 deletions

View File

@ -226,7 +226,8 @@ xmlSchemaInitBasicType(const char *name, xmlSchemaValType type,
(type == XML_SCHEMAS_NMTOKENS) ||
(type == XML_SCHEMAS_ENTITIES))
ret->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
else if (type != XML_SCHEMAS_UNKNOWN)
else if ((type != XML_SCHEMAS_ANYTYPE) &&
(type != XML_SCHEMAS_ANYSIMPLETYPE))
ret->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
ret->contentType = XML_SCHEMA_CONTENT_BASIC;
switch (type) {
@ -277,7 +278,7 @@ xmlSchemaInitTypes(void)
* 3.4.7 Built-in Complex Type Definition
*/
xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType",
XML_SCHEMAS_UNKNOWN,
XML_SCHEMAS_ANYTYPE,
NULL);
xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef;
xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;
@ -286,7 +287,7 @@ xmlSchemaInitTypes(void)
wild = (xmlSchemaWildcardPtr) xmlMalloc(sizeof(xmlSchemaWildcard));
if (wild == NULL) {
xmlSchemaTypeErrMemory(NULL, "could not create a wildcard on anyType");
xmlSchemaTypeErrMemory(NULL, "could not create an attribute wildcard on anyType");
return;
}
memset(wild, 0, sizeof(xmlSchemaWildcard));
@ -297,7 +298,7 @@ xmlSchemaInitTypes(void)
xmlSchemaTypeAnyTypeDef->attributeWildcard = wild;
}
xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType",
XML_SCHEMAS_UNKNOWN,
XML_SCHEMAS_ANYSIMPLETYPE,
xmlSchemaTypeAnyTypeDef);
/*
* primitive datatypes
@ -1744,11 +1745,11 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
}
switch (type->builtInType) {
case XML_SCHEMAS_UNKNOWN:
if ((type == xmlSchemaTypeAnySimpleTypeDef) ||
(type == xmlSchemaTypeAnyTypeDef))
goto return0;
case XML_SCHEMAS_UNKNOWN:
goto error;
case XML_SCHEMAS_ANYTYPE:
case XML_SCHEMAS_ANYSIMPLETYPE:
goto return0;
case XML_SCHEMAS_STRING:
goto return0;
case XML_SCHEMAS_NORMSTRING:{
@ -3548,6 +3549,8 @@ xmlSchemaCompareValues(xmlSchemaValPtr x, xmlSchemaValPtr y) {
switch (x->type) {
case XML_SCHEMAS_UNKNOWN:
case XML_SCHEMAS_ANYTYPE:
case XML_SCHEMAS_ANYSIMPLETYPE:
return(-2);
case XML_SCHEMAS_INTEGER:
case XML_SCHEMAS_NPINTEGER:
@ -3688,9 +3691,6 @@ xmlSchemaCompareValues(xmlSchemaValPtr x, xmlSchemaValPtr y) {
case XML_SCHEMAS_NMTOKENS:
TODO
break;
case XML_SCHEMAS_ANYTYPE:
case XML_SCHEMAS_ANYSIMPLETYPE:
break;
}
return -2;
}