1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

Removed inheritance of "mixed" content type for short-hand restrictions of

* xmlschemas.c: Removed inheritance of "mixed" content type for
  short-hand restrictions of "anyType" (reported by Guy Fabrice
  to the mailing list). Added the namespace conversion (chameleon
  includes) for the base type reference of <restriction> and
  <extension>.
* test/schemas/bug152470_1.xsd: Adapted due to the above change
  of "mixed" inheritance.
This commit is contained in:
Kasimier T. Buchcik
2005-03-17 12:39:31 +00:00
parent bc69d4f942
commit 289dbb45d9
3 changed files with 63 additions and 19 deletions

View File

@@ -1,3 +1,13 @@
Thu Mar 17 12:55:23 CET 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: Removed inheritance of "mixed" content type for
short-hand restrictions of "anyType" (reported by Guy Fabrice
to the mailing list). Added the namespace conversion (chameleon
includes) for the base type reference of <restriction> and
<extension>.
* test/schemas/bug152470_1.xsd: Adapted due to the above change
of "mixed" inheritance.
Thu Mar 17 11:03:59 CET 2005 Daniel Veillard <daniel@veillard.com> Thu Mar 17 11:03:59 CET 2005 Daniel Veillard <daniel@veillard.com>
* xmlschemas.c: fixed a = -> == error pointed by GUY Fabrice * xmlschemas.c: fixed a = -> == error pointed by GUY Fabrice

View File

@@ -13,7 +13,7 @@
<complexType name="Identifier"> <complexType name="Identifier">
<choice> <choice>
<element name="keyIdentifier" type="roap:KeyIdentifier"/> <element name="keyIdentifier" type="roap:X509SPKIHash"/> <!-- was: type="roap:KeyIdentifier" -->
</choice> </choice>
</complexType> </complexType>

View File

@@ -62,6 +62,8 @@
/* #define DEBUG_IDC 1 */ /* #define DEBUG_IDC 1 */
/* #define DEBUG_INCLUDES 1 */
#define UNBOUNDED (1 << 30) #define UNBOUNDED (1 << 30)
#define TODO \ #define TODO \
@@ -1441,6 +1443,18 @@ xmlSchemaVFacetErr(xmlSchemaValidCtxtPtr ctxt,
"maximum value allowed ('%s').\n"); "maximum value allowed ('%s').\n");
xmlSchemaVErr(ctxt, node, error, (const char *) msg, value, xmlSchemaVErr(ctxt, node, error, (const char *) msg, value,
facet->value); facet->value);
#if 0
} else if (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE) {
msg = xmlStrcat(msg, BAD_CAST "The value '%s' is less than the "
"minimum exclusive value allowed ('%s').\n");
xmlSchemaVErr(ctxt, node, error, (const char *) msg, value,
facet->value);
} else if (facetType == XML_SCHEMA_FACET_MAXEXCLUSIVE) {
msg = xmlStrcat(msg, BAD_CAST "The value '%s' is greater than the "
"maximum exclusive value allowed ('%s').\n");
xmlSchemaVErr(ctxt, node, error, (const char *) msg, value,
facet->value);
#endif
} else if (node->type == XML_ATTRIBUTE_NODE) { } else if (node->type == XML_ATTRIBUTE_NODE) {
msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not facet-valid.\n"); msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not facet-valid.\n");
xmlSchemaVErr(ctxt, node, error, (const char *) msg, value, NULL); xmlSchemaVErr(ctxt, node, error, (const char *) msg, value, NULL);
@@ -4130,6 +4144,7 @@ xmlSchemaAddWildcard(xmlSchemaParserCtxtPtr ctxt)
* * * *
************************************************************************/ ************************************************************************/
#if 0
/** /**
* xmlGetQNameProp: * xmlGetQNameProp:
* @ctxt: a schema validation context * @ctxt: a schema validation context
@@ -4187,6 +4202,7 @@ xmlGetQNameProp(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
} }
return (ret); return (ret);
} }
#endif
/** /**
* xmlSchemaPValAttrNodeQNameValue: * xmlSchemaPValAttrNodeQNameValue:
@@ -4340,6 +4356,8 @@ xmlSchemaPValAttrQName(xmlSchemaParserCtxtPtr ctxt,
attr = xmlSchemaGetPropNode(ownerElem, name); attr = xmlSchemaGetPropNode(ownerElem, name);
if (attr == NULL) { if (attr == NULL) {
*local = NULL; *local = NULL;
if (prefix != NULL)
*prefix = NULL;
*uri = NULL; *uri = NULL;
return (0); return (0);
} }
@@ -8611,6 +8629,17 @@ check_targetNamespace:
*/ */
include->origTargetNamespace = targetNamespace; include->origTargetNamespace = targetNamespace;
include->targetNamespace = schema->targetNamespace; include->targetNamespace = schema->targetNamespace;
#ifdef DEBUG_INCLUDES
if (targetNamespace != schema->targetNamespace)
xmlGenericError(xmlGenericErrorContext,
"INCLUDING CHAMELEON '%s'\n orig TNS '%s'\n"
" into TNS '%s'\n", schemaLocation,
targetNamespace, schema->targetNamespace);
else
xmlGenericError(xmlGenericErrorContext,
"INCLUDING '%s'\n orig-TNS '%s'\n", schemaLocation,
targetNamespace);
#endif
/* /*
* Compile the included schema. * Compile the included schema.
*/ */
@@ -8920,8 +8949,9 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
/* /*
* Attribute "base". * Attribute "base".
*/ */
type->base = xmlGetQNameProp(ctxt, node, "base", &(type->baseNs)); if ((xmlSchemaPValAttrQName(ctxt, schema,
if ((type->base == NULL) && NULL, NULL, node, "base", &(type->baseNs), NULL, &(type->base)) == 0) &&
(type->base == NULL) &&
(ctxt->ctxtType->type == XML_SCHEMA_TYPE_COMPLEX)) { (ctxt->ctxtType->type == XML_SCHEMA_TYPE_COMPLEX)) {
/* TODO: Think about the error code. */ /* TODO: Think about the error code. */
xmlSchemaPMissingAttrErr(ctxt, xmlSchemaPMissingAttrErr(ctxt,
@@ -9120,13 +9150,19 @@ xmlSchemaParseExtension(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id"); xmlSchemaPValAttrID(ctxt, NULL, NULL, node, BAD_CAST "id");
ctxt->container = name; ctxt->container = name;
/*
type->base = xmlGetQNameProp(ctxt, node, "base", &(type->baseNs)); * Attribute "base".
if (type->base == NULL) { */
xmlSchemaPErr2(ctxt, node, child, XML_SCHEMAP_EXTENSION_NO_BASE, if ((xmlSchemaPValAttrQName(ctxt, schema,
"<extension>: The attribute \"base\" is missing.\n", NULL, NULL, node, "base", &(type->baseNs), NULL, &(type->base)) == 0) &&
type->name, NULL); (type->base == NULL) &&
(ctxt->ctxtType->type == XML_SCHEMA_TYPE_COMPLEX)) {
/* TODO: Think about the error code. */
xmlSchemaPMissingAttrErr(ctxt,
XML_SCHEMAP_RESTRICTION_NONAME_NOREF,
NULL, type, node, "base", NULL);
} }
child = node->children; child = node->children;
if (IS_SCHEMA(child, "annotation")) { if (IS_SCHEMA(child, "annotation")) {
type->annot = xmlSchemaParseAnnotation(ctxt, schema, child); type->annot = xmlSchemaParseAnnotation(ctxt, schema, child);
@@ -13817,7 +13853,6 @@ xmlSchemaTypeFixup(xmlSchemaTypePtr item,
ctxt->ctxtType->flags |= ctxt->ctxtType->flags |=
XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION; XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION;
if (item->recurse) { if (item->recurse) {
/* TODO: The word "recursive" should be changed to "circular" here. */
xmlSchemaPCustomErr(ctxt, xmlSchemaPCustomErr(ctxt,
XML_SCHEMAP_UNKNOWN_BASE_TYPE, XML_SCHEMAP_UNKNOWN_BASE_TYPE,
NULL, item, item->node, NULL, item, item->node,
@@ -13914,11 +13949,10 @@ xmlSchemaTypeFixup(xmlSchemaTypePtr item,
item->flags |= item->flags |=
XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION; XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION;
/* /*
* Assume that we inherit the content-type type * NOTE that if restricting, the content type of the
* from 'anyType', which is 'mixed' and a particle * base type is not inherited.
* emptiable. * REMOVED: item->contentType = item->baseType->contentType;
*/ */
item->contentType = item->baseType->contentType;
} }
/* /*
* Fixup the sub components. * Fixup the sub components.