mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-01 10:06:59 +03:00
more fixes with Kasimier, looks far cleaner :-) Daniel
* xmlschemas.c: more fixes with Kasimier, looks far cleaner :-) Daniel
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Tue Jun 29 15:00:13 PDT 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlschemas.c: more fixes with Kasimier, looks far cleaner :-)
|
||||||
|
|
||||||
Tue Jun 29 23:00:05 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
Tue Jun 29 23:00:05 CEST 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* xmlschemas.c: Kasimier Buchcik fixed the memory access and
|
* xmlschemas.c: Kasimier Buchcik fixed the memory access and
|
||||||
|
@ -256,7 +256,7 @@
|
|||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#undef PACKAGE_VERSION
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
/* Define to 1 if the C compiler supports function prototypes. */
|
/* Define if compiler has function prototypes */
|
||||||
#undef PROTOTYPES
|
#undef PROTOTYPES
|
||||||
|
|
||||||
/* Determine what socket length (socklen_t) data type is */
|
/* Determine what socket length (socklen_t) data type is */
|
||||||
@ -274,9 +274,6 @@
|
|||||||
/* Using the Win32 Socket implementation */
|
/* Using the Win32 Socket implementation */
|
||||||
#undef _WINSOCKAPI_
|
#undef _WINSOCKAPI_
|
||||||
|
|
||||||
/* Define like PROTOTYPES; this can be used by system headers. */
|
|
||||||
#undef __PROTOTYPES
|
|
||||||
|
|
||||||
/* Win32 Std C name mangling work-around */
|
/* Win32 Std C name mangling work-around */
|
||||||
#undef snprintf
|
#undef snprintf
|
||||||
|
|
||||||
|
@ -421,6 +421,7 @@ dnl specific tests to setup DV's devel environment with debug etc ...
|
|||||||
dnl (-Wunreachable-code)
|
dnl (-Wunreachable-code)
|
||||||
dnl
|
dnl
|
||||||
if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
|
if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
|
||||||
|
[[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
|
||||||
[[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomecvs/xmltest" ]] || \
|
[[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomecvs/xmltest" ]] || \
|
||||||
[[ "${LOGNAME}" = "wbrack" -a "`pwd`" = "/Users/wbrack/gnomecvs/xmltest" ]]
|
[[ "${LOGNAME}" = "wbrack" -a "`pwd`" = "/Users/wbrack/gnomecvs/xmltest" ]]
|
||||||
then
|
then
|
||||||
|
290
xmlschemas.c
290
xmlschemas.c
@ -1001,12 +1001,9 @@ xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output)
|
|||||||
case XML_SCHEMA_CONTENT_MIXED:
|
case XML_SCHEMA_CONTENT_MIXED:
|
||||||
fprintf(output, "mixed ");
|
fprintf(output, "mixed ");
|
||||||
break;
|
break;
|
||||||
/* Removed, since not used. */
|
|
||||||
/*
|
|
||||||
case XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS:
|
case XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS:
|
||||||
fprintf(output, "mixed_or_elems ");
|
/* not used. */
|
||||||
break;
|
break;
|
||||||
*/
|
|
||||||
case XML_SCHEMA_CONTENT_BASIC:
|
case XML_SCHEMA_CONTENT_BASIC:
|
||||||
fprintf(output, "basic ");
|
fprintf(output, "basic ");
|
||||||
break;
|
break;
|
||||||
@ -1084,7 +1081,7 @@ xmlSchemaDump(FILE * output, xmlSchemaPtr schema)
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
xmlAttrPtr
|
static xmlAttrPtr
|
||||||
xmlSchemaGetPropNode(xmlNodePtr node, const xmlChar *name)
|
xmlSchemaGetPropNode(xmlNodePtr node, const xmlChar *name)
|
||||||
{
|
{
|
||||||
xmlAttrPtr prop;
|
xmlAttrPtr prop;
|
||||||
@ -1803,174 +1800,6 @@ xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaNewItemInternal:
|
|
||||||
* @ctxt: the schema parser context
|
|
||||||
* @name: the internal name of the restriction
|
|
||||||
*
|
|
||||||
* Createa an schema item
|
|
||||||
*
|
|
||||||
* Returns the new structure or NULL in case of an error.
|
|
||||||
*/
|
|
||||||
static xmlSchemaTypePtr
|
|
||||||
xmlSchemaNewItemInternal(xmlSchemaParserCtxtPtr ctxt,
|
|
||||||
const xmlChar * name)
|
|
||||||
{
|
|
||||||
xmlSchemaTypePtr ret = NULL;
|
|
||||||
|
|
||||||
if ((ctxt == NULL) || (name == NULL))
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr, "Creating item %s\n", name);
|
|
||||||
#endif
|
|
||||||
ret = (xmlSchemaTypePtr) xmlMalloc(sizeof(xmlSchemaType));
|
|
||||||
if (ret == NULL) {
|
|
||||||
xmlSchemaPErrMemory(ctxt, "allocating item", NULL);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
memset(ret, 0, sizeof(xmlSchemaType));
|
|
||||||
ret->name = xmlDictLookup(ctxt->dict, name, -1);
|
|
||||||
ret->minOccurs = 1;
|
|
||||||
ret->maxOccurs = 1;
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaNewRestriction:
|
|
||||||
* @ctxt: the schema parser context
|
|
||||||
* @name: the internal name of the restriction
|
|
||||||
*
|
|
||||||
* Create a <restriction> item
|
|
||||||
*
|
|
||||||
* Returns the new structure or NULL in case of an error.
|
|
||||||
*/
|
|
||||||
static xmlSchemaTypePtr
|
|
||||||
xmlSchemaNewRestriction(xmlSchemaParserCtxtPtr ctxt,
|
|
||||||
const xmlChar * name)
|
|
||||||
{
|
|
||||||
xmlSchemaTypePtr ret;
|
|
||||||
|
|
||||||
ret = xmlSchemaNewItemInternal(ctxt, name);
|
|
||||||
if (ret != NULL)
|
|
||||||
ret->type = XML_SCHEMA_TYPE_RESTRICTION;
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaNewExtension:
|
|
||||||
* @ctxt: the schema parser context
|
|
||||||
* @name: the internal name of the extension
|
|
||||||
*
|
|
||||||
* Create an <extension> item
|
|
||||||
*
|
|
||||||
* Returns the new structure or NULL in case of an error.
|
|
||||||
*/
|
|
||||||
static xmlSchemaTypePtr
|
|
||||||
xmlSchemaNewExtension(xmlSchemaParserCtxtPtr ctxt,
|
|
||||||
const xmlChar * name)
|
|
||||||
{
|
|
||||||
xmlSchemaTypePtr ret;
|
|
||||||
|
|
||||||
ret = xmlSchemaNewItemInternal(ctxt, name);
|
|
||||||
if (ret != NULL)
|
|
||||||
ret->type = XML_SCHEMA_TYPE_EXTENSION;
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaNewSimpleContent:
|
|
||||||
* @ctxt: the schema parser context
|
|
||||||
* @name: the internal name of the simpleContent
|
|
||||||
*
|
|
||||||
* Create a <simpleContent> item
|
|
||||||
*
|
|
||||||
* Returns the new structure or NULL in case of an error.
|
|
||||||
*/
|
|
||||||
static xmlSchemaTypePtr
|
|
||||||
xmlSchemaNewSimpleContent(xmlSchemaParserCtxtPtr ctxt,
|
|
||||||
const xmlChar * name)
|
|
||||||
{
|
|
||||||
xmlSchemaTypePtr ret;
|
|
||||||
|
|
||||||
ret = xmlSchemaNewItemInternal(ctxt, name);
|
|
||||||
if (ret != NULL)
|
|
||||||
ret->type = XML_SCHEMA_TYPE_SIMPLE_CONTENT;
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaNewComplexContent:
|
|
||||||
* @ctxt: the schema parser context
|
|
||||||
* @name: the internal name of the complexContent
|
|
||||||
*
|
|
||||||
* Create a <complexContent> item
|
|
||||||
*
|
|
||||||
* Returns the new structure or NULL in case of an error.
|
|
||||||
*/
|
|
||||||
static xmlSchemaTypePtr
|
|
||||||
xmlSchemaNewComplexContent(xmlSchemaParserCtxtPtr ctxt,
|
|
||||||
const xmlChar * name)
|
|
||||||
{
|
|
||||||
xmlSchemaTypePtr ret;
|
|
||||||
|
|
||||||
ret = xmlSchemaNewItemInternal(ctxt, name);
|
|
||||||
if (ret != NULL)
|
|
||||||
ret->type = XML_SCHEMA_TYPE_COMPLEX_CONTENT;
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaNewUnion:
|
|
||||||
* @ctxt: the schema parser context
|
|
||||||
* @name: the internal name of the union
|
|
||||||
*
|
|
||||||
* Create an <union> item
|
|
||||||
* *WARNING* this interface is highly subject to change
|
|
||||||
*
|
|
||||||
* Returns the new structure or NULL in case of an error.
|
|
||||||
*/
|
|
||||||
static xmlSchemaTypePtr
|
|
||||||
xmlSchemaNewUnion(xmlSchemaParserCtxtPtr ctxt,
|
|
||||||
const xmlChar * name)
|
|
||||||
{
|
|
||||||
xmlSchemaTypePtr ret;
|
|
||||||
|
|
||||||
ret = xmlSchemaNewItemInternal(ctxt, name);
|
|
||||||
if (ret != NULL)
|
|
||||||
ret->type = XML_SCHEMA_TYPE_UNION;
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaNewList:
|
|
||||||
* @ctxt: the schema parser context
|
|
||||||
* @name: the internal name of the union
|
|
||||||
*
|
|
||||||
* Create an <union> item
|
|
||||||
* *WARNING* this interface is highly subject to change
|
|
||||||
*
|
|
||||||
* Returns the new structure or NULL in case of an error.
|
|
||||||
*/
|
|
||||||
static xmlSchemaTypePtr
|
|
||||||
xmlSchemaNewList(xmlSchemaParserCtxtPtr ctxt,
|
|
||||||
const xmlChar * name)
|
|
||||||
{
|
|
||||||
xmlSchemaTypePtr ret;
|
|
||||||
|
|
||||||
ret = xmlSchemaNewItemInternal(ctxt, name);
|
|
||||||
if (ret != NULL)
|
|
||||||
ret->type = XML_SCHEMA_TYPE_LIST;
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlSchemaAddGroup:
|
* xmlSchemaAddGroup:
|
||||||
* @ctxt: a schema validation context
|
* @ctxt: a schema validation context
|
||||||
@ -2258,8 +2087,7 @@ static xmlSchemaTypePtr xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr
|
|||||||
static xmlSchemaTypePtr xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr
|
static xmlSchemaTypePtr xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr
|
||||||
ctxt,
|
ctxt,
|
||||||
xmlSchemaPtr schema,
|
xmlSchemaPtr schema,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node);
|
||||||
int simple);
|
|
||||||
static xmlSchemaTypePtr xmlSchemaParseSequence(xmlSchemaParserCtxtPtr ctxt,
|
static xmlSchemaTypePtr xmlSchemaParseSequence(xmlSchemaParserCtxtPtr ctxt,
|
||||||
xmlSchemaPtr schema,
|
xmlSchemaPtr schema,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
@ -2318,7 +2146,6 @@ xmlSchemaParseSchemaAttrValue(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
case XML_SCHEMAS_QNAME:
|
case XML_SCHEMAS_QNAME:
|
||||||
ret = xmlValidateQName(value, 1);
|
ret = xmlValidateQName(value, 1);
|
||||||
if ((ret == 0) && (attr != NULL)) {
|
if ((ret == 0) && (attr != NULL)) {
|
||||||
xmlChar *uri = NULL;
|
|
||||||
xmlChar *local = NULL;
|
xmlChar *local = NULL;
|
||||||
xmlChar *prefix;
|
xmlChar *prefix;
|
||||||
|
|
||||||
@ -3400,7 +3227,7 @@ xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
|
|||||||
/*
|
/*
|
||||||
* Check type of "itemType".
|
* Check type of "itemType".
|
||||||
*/
|
*/
|
||||||
attr = xmlSchemaGetPropNode(node, "itemType");
|
attr = xmlSchemaGetPropNode(node, BAD_CAST "itemType");
|
||||||
if (attr != NULL) {
|
if (attr != NULL) {
|
||||||
type->base = xmlGetQNameProp(ctxt, node, "itemType", &(type->baseNs));
|
type->base = xmlGetQNameProp(ctxt, node, "itemType", &(type->baseNs));
|
||||||
xmlSchemaParseSchemaAttrValue(ctxt, attr,
|
xmlSchemaParseSchemaAttrValue(ctxt, attr,
|
||||||
@ -3536,7 +3363,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
|
|||||||
ctxt->parentItem = type;
|
ctxt->parentItem = type;
|
||||||
if (IS_SCHEMA(child, "restriction")) {
|
if (IS_SCHEMA(child, "restriction")) {
|
||||||
subtype = (xmlSchemaTypePtr)
|
subtype = (xmlSchemaTypePtr)
|
||||||
xmlSchemaParseRestriction(ctxt, schema, child, 1);
|
xmlSchemaParseRestriction(ctxt, schema, child);
|
||||||
child = child->next;
|
child = child->next;
|
||||||
} else if (IS_SCHEMA(child, "list")) {
|
} else if (IS_SCHEMA(child, "list")) {
|
||||||
subtype = (xmlSchemaTypePtr)
|
subtype = (xmlSchemaTypePtr)
|
||||||
@ -4431,7 +4258,6 @@ xmlSchemaParseSequence(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
|
|||||||
* @ctxt: a schema validation context
|
* @ctxt: a schema validation context
|
||||||
* @schema: the schema being built
|
* @schema: the schema being built
|
||||||
* @node: a subtree containing XML Schema informations
|
* @node: a subtree containing XML Schema informations
|
||||||
* @simple: is that part of a simple type.
|
|
||||||
*
|
*
|
||||||
* parse a XML schema Restriction definition
|
* parse a XML schema Restriction definition
|
||||||
* *WARNING* this interface is highly subject to change
|
* *WARNING* this interface is highly subject to change
|
||||||
@ -4440,7 +4266,7 @@ xmlSchemaParseSequence(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
|
|||||||
*/
|
*/
|
||||||
static xmlSchemaTypePtr
|
static xmlSchemaTypePtr
|
||||||
xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
|
xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
|
||||||
xmlNodePtr node, int simple)
|
xmlNodePtr node)
|
||||||
{
|
{
|
||||||
xmlSchemaTypePtr type, subtype;
|
xmlSchemaTypePtr type, subtype;
|
||||||
xmlNodePtr child = NULL;
|
xmlNodePtr child = NULL;
|
||||||
@ -4692,7 +4518,7 @@ xmlSchemaParseSimpleContent(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
subtype = NULL;
|
subtype = NULL;
|
||||||
if (IS_SCHEMA(child, "restriction")) {
|
if (IS_SCHEMA(child, "restriction")) {
|
||||||
subtype = (xmlSchemaTypePtr)
|
subtype = (xmlSchemaTypePtr)
|
||||||
xmlSchemaParseRestriction(ctxt, schema, child, 0);
|
xmlSchemaParseRestriction(ctxt, schema, child);
|
||||||
child = child->next;
|
child = child->next;
|
||||||
} else if (IS_SCHEMA(child, "extension")) {
|
} else if (IS_SCHEMA(child, "extension")) {
|
||||||
subtype = (xmlSchemaTypePtr)
|
subtype = (xmlSchemaTypePtr)
|
||||||
@ -4748,7 +4574,7 @@ xmlSchemaParseComplexContent(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
subtype = NULL;
|
subtype = NULL;
|
||||||
if (IS_SCHEMA(child, "restriction")) {
|
if (IS_SCHEMA(child, "restriction")) {
|
||||||
subtype = (xmlSchemaTypePtr)
|
subtype = (xmlSchemaTypePtr)
|
||||||
xmlSchemaParseRestriction(ctxt, schema, child, 0);
|
xmlSchemaParseRestriction(ctxt, schema, child);
|
||||||
child = child->next;
|
child = child->next;
|
||||||
} else if (IS_SCHEMA(child, "extension")) {
|
} else if (IS_SCHEMA(child, "extension")) {
|
||||||
subtype = (xmlSchemaTypePtr)
|
subtype = (xmlSchemaTypePtr)
|
||||||
@ -6720,8 +6546,6 @@ xmlSchemaBuildAttributeValidation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaTypePtr
|
|||||||
type->name, NULL);
|
type->name, NULL);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if ((type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION) ||
|
|
||||||
(type->flags & XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION)) {
|
|
||||||
|
|
||||||
baseType = type->baseType;
|
baseType = type->baseType;
|
||||||
if (baseType == NULL) {
|
if (baseType == NULL) {
|
||||||
@ -6872,31 +6696,7 @@ xmlSchemaBuildAttributeValidation(xmlSchemaParserCtxtPtr ctxt, xmlSchemaTypePtr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Removed, since anyType was plugged into the derivation hierarchy.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
else {
|
|
||||||
*
|
|
||||||
* Although the complexType is implicitely derived by "restriction"
|
|
||||||
* from the ur-type, this is not (yet?) reflected by libxml2.
|
|
||||||
*
|
|
||||||
baseType = NULL;
|
|
||||||
attrs = type->attributes;
|
|
||||||
if (attrs != NULL) {
|
|
||||||
if (xmlSchemaBuildCompleteAttributeWildcard(ctxt,
|
|
||||||
attrs, &type->attributeWildcard) == -1) {
|
|
||||||
if ((type->attributeWildcard != NULL) &&
|
|
||||||
(type->attributeWildcard != type->subtypes->subtypes->attributeWildcard))
|
|
||||||
type->flags |= XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD;
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
if ((type->attributeWildcard != NULL) &&
|
|
||||||
((type->flags & XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD) == 0))
|
|
||||||
type->flags |= XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD;
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
/*
|
/*
|
||||||
* Gather attribute uses defined by this type.
|
* Gather attribute uses defined by this type.
|
||||||
*/
|
*/
|
||||||
@ -7183,7 +6983,7 @@ xmlSchemaTypeFinalContains(xmlSchemaPtr schema, xmlSchemaTypePtr type, int final
|
|||||||
* Returns a list of member types of @type if existing,
|
* Returns a list of member types of @type if existing,
|
||||||
* returns NULL otherwise.
|
* returns NULL otherwise.
|
||||||
*/
|
*/
|
||||||
xmlSchemaTypeLinkPtr
|
static xmlSchemaTypeLinkPtr
|
||||||
xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type)
|
xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type)
|
||||||
{
|
{
|
||||||
while (type != NULL) {
|
while (type != NULL) {
|
||||||
@ -7505,7 +7305,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
"is not allowed on primitive type \"%s\".\n",
|
"is not allowed on primitive type \"%s\".\n",
|
||||||
type->name,
|
type->name,
|
||||||
xmlSchemaFacetTypeToString(facet->type),
|
xmlSchemaFacetTypeToString(facet->type),
|
||||||
primitive->name, NULL, NULL);
|
BAD_CAST primitive->name, NULL, NULL);
|
||||||
|
|
||||||
ok = 0;
|
ok = 0;
|
||||||
}
|
}
|
||||||
@ -7594,7 +7394,8 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2,
|
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2,
|
||||||
"List simple type \"%s\": the facet \"%s\" "
|
"List simple type \"%s\": the facet \"%s\" "
|
||||||
"is not allowed.\n",
|
"is not allowed.\n",
|
||||||
type->name, xmlSchemaFacetTypeToString(facet->type));
|
type->name,
|
||||||
|
BAD_CAST xmlSchemaFacetTypeToString(facet->type));
|
||||||
return (XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2);
|
return (XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2);
|
||||||
}
|
}
|
||||||
facet = facet->next;
|
facet = facet->next;
|
||||||
@ -7696,7 +7497,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
"List simple type \"%s\": the facet \"%s\" "
|
"List simple type \"%s\": the facet \"%s\" "
|
||||||
"is not allowed.\n",
|
"is not allowed.\n",
|
||||||
type->name,
|
type->name,
|
||||||
xmlSchemaFacetTypeToString(facet->type));
|
BAD_CAST xmlSchemaFacetTypeToString(facet->type));
|
||||||
/*
|
/*
|
||||||
* We could return, but it's nicer to report all
|
* We could return, but it's nicer to report all
|
||||||
* invalid facets.
|
* invalid facets.
|
||||||
@ -7876,7 +7677,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
"Union simple type \"%s\": the facet \"%s\" "
|
"Union simple type \"%s\": the facet \"%s\" "
|
||||||
"is not allowed.\n",
|
"is not allowed.\n",
|
||||||
type->name,
|
type->name,
|
||||||
xmlSchemaFacetTypeToString(facet->type));
|
BAD_CAST xmlSchemaFacetTypeToString(facet->type));
|
||||||
ok = 0;
|
ok = 0;
|
||||||
}
|
}
|
||||||
facet = facet->next;
|
facet = facet->next;
|
||||||
@ -8060,6 +7861,8 @@ xmlSchemaTypeFixup(xmlSchemaTypePtr typeDecl,
|
|||||||
case XML_SCHEMA_TYPE_RESTRICTION:
|
case XML_SCHEMA_TYPE_RESTRICTION:
|
||||||
case XML_SCHEMA_TYPE_EXTENSION:
|
case XML_SCHEMA_TYPE_EXTENSION:
|
||||||
return;
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
@ -8611,7 +8414,7 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet,
|
|||||||
"Type \"%s\": the value \"%s\" of the "
|
"Type \"%s\": the value \"%s\" of the "
|
||||||
"facet \"%s\" is invalid.\n",
|
"facet \"%s\" is invalid.\n",
|
||||||
name, facet->value,
|
name, facet->value,
|
||||||
xmlSchemaFacetTypeToString(facet->type),
|
BAD_CAST xmlSchemaFacetTypeToString(facet->type),
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -8694,7 +8497,7 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet,
|
|||||||
"Type \"%s\": the value \"%s\" of the "
|
"Type \"%s\": the value \"%s\" of the "
|
||||||
"facet \"%s\" is invalid.\n",
|
"facet \"%s\" is invalid.\n",
|
||||||
name, facet->value,
|
name, facet->value,
|
||||||
xmlSchemaFacetTypeToString(facet->type),
|
BAD_CAST xmlSchemaFacetTypeToString(facet->type),
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -9120,27 +8923,6 @@ xmlSchemaValidateFacetsInternal(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaValidateFacets:
|
|
||||||
* @ctxt: a schema validation context
|
|
||||||
* @base: the base type
|
|
||||||
* @facets: the list of facets to check
|
|
||||||
* @value: the lexical repr of the value to validate
|
|
||||||
* @val: the precomputed value
|
|
||||||
*
|
|
||||||
* Check a value against all facet conditions
|
|
||||||
*
|
|
||||||
* Returns 0 if the element is schemas valid, a positive error code
|
|
||||||
* number otherwise and -1 in case of internal or API error.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
xmlSchemaValidateFacets(xmlSchemaValidCtxtPtr ctxt,
|
|
||||||
xmlSchemaTypePtr base,
|
|
||||||
xmlSchemaFacetLinkPtr facets, const xmlChar * value)
|
|
||||||
{
|
|
||||||
return(xmlSchemaValidateFacetsInternal(ctxt, base, facets, value, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Simple type validation *
|
* Simple type validation *
|
||||||
@ -9576,35 +9358,6 @@ xmlSchemaValidateCheckNodeList(xmlNodePtr nodelist)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlSchemaSkipIgnored:
|
|
||||||
* @ctxt: a schema validation context
|
|
||||||
* @type: the current type context
|
|
||||||
* @node: the top node.
|
|
||||||
*
|
|
||||||
* Skip ignorable nodes in that context
|
|
||||||
*
|
|
||||||
* Returns the new sibling
|
|
||||||
* number otherwise and -1 in case of internal or API error.
|
|
||||||
*/
|
|
||||||
static xmlNodePtr
|
|
||||||
xmlSchemaSkipIgnored(xmlSchemaValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
|
||||||
xmlSchemaTypePtr type, xmlNodePtr node)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* TODO complete and handle entities
|
|
||||||
*/
|
|
||||||
while ((node != NULL) &&
|
|
||||||
((node->type == XML_COMMENT_NODE) ||
|
|
||||||
((type->contentType == XML_SCHEMA_CONTENT_MIXED) &&
|
|
||||||
(node->type == XML_TEXT_NODE)) ||
|
|
||||||
(((type->contentType == XML_SCHEMA_CONTENT_ELEMENTS) &&
|
|
||||||
(node->type == XML_TEXT_NODE) && (IS_BLANK_NODE(node)))))) {
|
|
||||||
node = node->next;
|
|
||||||
}
|
|
||||||
return (node);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlSchemaValidateCallback:
|
* xmlSchemaValidateCallback:
|
||||||
* @ctxt: a schema validation context
|
* @ctxt: a schema validation context
|
||||||
@ -10013,7 +9766,8 @@ xmlSchemaValidateSimpleTypeValue(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
type->name, NULL);
|
type->name, NULL);
|
||||||
} else if ((ret == 0) && (applyFacets) &&
|
} else if ((ret == 0) && (applyFacets) &&
|
||||||
(type->facetSet != NULL)) {
|
(type->facetSet != NULL)) {
|
||||||
int expLen, okFacet = 0, hasFacet = 0;
|
int okFacet = 0, hasFacet = 0;
|
||||||
|
unsigned long expLen;
|
||||||
xmlSchemaFacetPtr facet;
|
xmlSchemaFacetPtr facet;
|
||||||
xmlSchemaFacetLinkPtr facetLink;
|
xmlSchemaFacetLinkPtr facetLink;
|
||||||
xmlChar *collapsedValue = NULL;
|
xmlChar *collapsedValue = NULL;
|
||||||
@ -10045,7 +9799,7 @@ xmlSchemaValidateSimpleTypeValue(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
* length value?
|
* length value?
|
||||||
*/
|
*/
|
||||||
snprintf(l, 24, "%d", len);
|
snprintf(l, 24, "%d", len);
|
||||||
snprintf(fl, 24, "%d", expLen);
|
snprintf(fl, 24, "%lu", expLen);
|
||||||
if (ret == XML_SCHEMAV_CVC_LENGTH_VALID) {
|
if (ret == XML_SCHEMAV_CVC_LENGTH_VALID) {
|
||||||
xmlSchemaVErr(ctxt, ctxt->cur, ret,
|
xmlSchemaVErr(ctxt, ctxt->cur, ret,
|
||||||
"The value with length \"%s\" is not "
|
"The value with length \"%s\" is not "
|
||||||
|
Reference in New Issue
Block a user