1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-08 17:42:14 +03:00

updated a bit made a comment more specific more work on the Schemas

* TODO: updated a bit
* parser.c: made a comment more specific
* xmlregexp.c xmlschemas.c xmlschemastypes.c: more work on the
  Schemas conformance.
* test/schemas result/schemas: updated the test list
Daniel
This commit is contained in:
Daniel Veillard
2002-04-22 16:01:24 +00:00
parent 441bc32e31
commit e19fc23b64
27 changed files with 292 additions and 34 deletions

View File

@@ -55,6 +55,7 @@ struct _xmlSchemaParserCtxt {
void *userData; /* user specific data block */
xmlSchemaValidityErrorFunc error; /* the callback in case of errors */
xmlSchemaValidityWarningFunc warning;/* the callback in case of warning */
xmlSchemaValidError err;
xmlSchemaPtr schema; /* The schema in use */
xmlChar *container; /* the current element, group, ... */
@@ -3059,7 +3060,6 @@ xmlSchemaBuildAContentModel(xmlSchemaTypePtr type,
lax = type->minOccurs == 0;
ctxt->state = xmlAutomataNewAllTrans(ctxt->am, ctxt->state, NULL,
lax);
TODO
break;
}
case XML_SCHEMA_TYPE_RESTRICTION:
@@ -3128,12 +3128,19 @@ xmlSchemaBuildContentModel(xmlSchemaElementPtr elem,
start = ctxt->state = xmlAutomataGetInitState(ctxt->am);
xmlSchemaBuildAContentModel(elem->subtypes, ctxt, name);
xmlAutomataSetFinalState(ctxt->am, ctxt->state);
elem->contModel = xmlAutomataCompile(ctxt->am);
if (!xmlAutomataIsDeterminist(ctxt->am)) {
xmlGenericError(xmlGenericErrorContext,
"Content model of %s is not determinist:\n", name);
elem->contModel = xmlAutomataCompile(ctxt->am);
ctxt->err = XML_SCHEMAS_ERR_NOTDETERMINIST;
} else {
elem->contModel = xmlAutomataCompile(ctxt->am);
#ifdef DEBUG_CONTENT
xmlGenericError(xmlGenericErrorContext,
"Content model of %s:\n", name);
xmlRegexpPrint(stderr, elem->contModel);
xmlGenericError(xmlGenericErrorContext,
"Content model of %s:\n", name);
xmlRegexpPrint(stderr, elem->contModel);
#endif
}
ctxt->state = NULL;
xmlFreeAutomata(ctxt->am);
ctxt->am = NULL;
@@ -4461,8 +4468,6 @@ xmlSchemaValidateComplexType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
child = ctxt->node;
type = ctxt->type;
/* 3.4.4 1 was verified on the caller */
switch (type->contentType) {
case XML_SCHEMA_CONTENT_EMPTY:
if (child != NULL) {
@@ -4471,6 +4476,15 @@ xmlSchemaValidateComplexType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
"Element %s is supposed to be empty\n",
node->name);
}
if (type->attributes != NULL) {
xmlSchemaValidateAttributes(ctxt, node, type->attributes);
}
subtype = type->subtypes;
while (subtype != NULL) {
ctxt->type = subtype;
xmlSchemaValidateComplexType(ctxt, node);
subtype = subtype->next;
}
break;
case XML_SCHEMA_CONTENT_ELEMENTS:
case XML_SCHEMA_CONTENT_MIXED:
@@ -4479,7 +4493,6 @@ xmlSchemaValidateComplexType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
* Skip ignorable nodes in that context
*/
child = xmlSchemaSkipIgnored(ctxt, type, child);
subtype = type->subtypes;
while (child != NULL) {
if (child->type == XML_ELEMENT_NODE) {
ret = xmlRegExecPushString(ctxt->regexp,
@@ -4543,6 +4556,8 @@ xmlSchemaValidateContent(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
child = ctxt->node;
type = ctxt->type;
xmlSchemaValidateAttributes(ctxt, node, type->attributes);
switch (type->type) {
case XML_SCHEMA_TYPE_ANY:
/* Any type will do it, fine */