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

Corrected 'length' facet validation for QNames and notations. Corrected

* xmlschemastypes.c: Corrected 'length' facet validation for
  QNames and notations. Corrected xmlSchemaGetCanonValue: some
  data types did not return a value if already in normalized
  form.
* xmlschemas.c include/libxml/schemasInternals.h:
  Eliminated creation of structs for <restriction>, <extension>,
  <simpleContent>, <complexContent>, <list> and <union>: the
  information is now set directly on the corresponding simple/
  complex type. Added some more complex type constraints.
  Added facet derivation constraints. Introduced "particle"
  components, which seem to be really needed if applying
  constraints. Corrected/change some of the parsing functions.
  This is all a bit scary, since a significant change to the code.
* result/schemas/src-element2-*.err result/schemas/element-*.err:
  Adapted regression test results.
This commit is contained in:
Kasimier T. Buchcik
2005-04-01 15:17:27 +00:00
parent 5d4644ef6e
commit aba15f7670
3 changed files with 4351 additions and 3055 deletions

View File

@@ -4820,6 +4820,14 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
}
return(XML_SCHEMAV_CVC_ENUMERATION_VALID);
case XML_SCHEMA_FACET_LENGTH:
/*
* SPEC (1.3) "if {primitive type definition} is QName or NOTATION,
* then any {value} is facet-valid."
*/
if ((valType == XML_SCHEMAS_QNAME) ||
(valType == XML_SCHEMAS_NOTATION))
return (0);
/* No break on purpose. */
case XML_SCHEMA_FACET_MAXLENGTH:
case XML_SCHEMA_FACET_MINLENGTH: {
unsigned int len = 0;
@@ -4870,9 +4878,6 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
case XML_SCHEMAS_NAME:
case XML_SCHEMAS_NCNAME:
case XML_SCHEMAS_ID:
/*
* FIXME: What exactly to do with anyURI?
*/
case XML_SCHEMAS_ANYURI:
if (value != NULL)
len = xmlSchemaNormLen(value);
@@ -5048,7 +5053,11 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue)
case XML_SCHEMAS_ANYURI:
if (val->value.str == NULL)
return (-1);
*retValue = BAD_CAST xmlSchemaCollapseString(BAD_CAST val->value.str);
*retValue =
BAD_CAST xmlSchemaCollapseString(BAD_CAST val->value.str);
if (*retValue == NULL)
*retValue =
BAD_CAST xmlStrdup((const xmlChar *) val->value.str);
break;
case XML_SCHEMAS_QNAME:
/*