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
diff --git a/xmlschemas.c b/xmlschemas.c
index 606b66b..fb48801 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -55,6 +55,7 @@
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 @@
lax = type->minOccurs == 0;
ctxt->state = xmlAutomataNewAllTrans(ctxt->am, ctxt->state, NULL,
lax);
- TODO
break;
}
case XML_SCHEMA_TYPE_RESTRICTION:
@@ -3128,12 +3128,19 @@
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 @@
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 @@
"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 @@
* 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 @@
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 */