diff --git a/ChangeLog b/ChangeLog index 5289405f..6479af9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Jul 19 17:27:26 CEST 2005 Daniel Veillard + + * xmlregexp.c xmlschemas.c: fixed the error reporting for + not transitions + * result/schemas/any5_0_0* result/schemas/any5_0_2* + result/schemas/any5_1_0*: fixed output + Tue Jul 19 15:34:12 CEST 2005 Daniel Veillard * xmlregexp.c xmlschemas.c include/libxml/xmlautomata.h: fixing diff --git a/result/schemas/any5_0_0.err b/result/schemas/any5_0_0.err index f9c434f1..137229b8 100644 --- a/result/schemas/any5_0_0.err +++ b/result/schemas/any5_0_0.err @@ -1 +1 @@ -./test/schemas/any5_0.xml:4: element foo: Schemas validity error : Element '{urn:test:foo}foo': Missing child element(s). +./test/schemas/any5_0.xml:6: element boo: Schemas validity error : Element '{urn:test:foo}boo': This element is not expected. Expected is ( not {urn:test:foo}* ). diff --git a/result/schemas/any5_0_2.err b/result/schemas/any5_0_2.err index 68d77f1d..a5bf4c08 100644 --- a/result/schemas/any5_0_2.err +++ b/result/schemas/any5_0_2.err @@ -1 +1 @@ -./test/schemas/any5_2.xml:4: element foo: Schemas validity error : Element '{urn:test:foo}foo': Missing child element(s). +./test/schemas/any5_2.xml:7: element boo: Schemas validity error : Element '{urn:test:foo}boo': This element is not expected. diff --git a/result/schemas/any5_1_0.err b/result/schemas/any5_1_0.err index f9c434f1..137229b8 100644 --- a/result/schemas/any5_1_0.err +++ b/result/schemas/any5_1_0.err @@ -1 +1 @@ -./test/schemas/any5_0.xml:4: element foo: Schemas validity error : Element '{urn:test:foo}foo': Missing child element(s). +./test/schemas/any5_0.xml:6: element boo: Schemas validity error : Element '{urn:test:foo}boo': This element is not expected. Expected is ( not {urn:test:foo}* ). diff --git a/xmlregexp.c b/xmlregexp.c index 536e9f8b..eba09a9f 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -752,6 +752,8 @@ xmlRegFreeAtom(xmlRegAtomPtr atom) { xmlFree(atom->ranges); if ((atom->type == XML_REGEXP_STRING) && (atom->valuep != NULL)) xmlFree(atom->valuep); + if ((atom->type == XML_REGEXP_STRING) && (atom->valuep2 != NULL)) + xmlFree(atom->valuep2); if ((atom->type == XML_REGEXP_BLOCK_NAME) && (atom->valuep != NULL)) xmlFree(atom->valuep); xmlFree(atom); @@ -3165,7 +3167,7 @@ xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, } /** - * xmlRegExecGetalues: + * xmlRegExecGetValues: * @exec: a regexp execution context * @err: error extraction or normal one * @nbval: pointer to the number of accepted values IN/OUT @@ -3274,14 +3276,20 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, count = exec->counts[trans->counter]; counter = &exec->comp->counters[trans->counter]; if (count < counter->max) { - values[nb++] = (xmlChar *) atom->valuep; + if (atom->neg) + values[nb++] = (xmlChar *) atom->valuep2; + else + values[nb++] = (xmlChar *) atom->valuep; (*nbval)++; } } else { if ((exec->comp->states[trans->to] != NULL) && (exec->comp->states[trans->to]->type != XML_REGEXP_SINK_STATE)) { - values[nb++] = (xmlChar *) atom->valuep; + if (atom->neg) + values[nb++] = (xmlChar *) atom->valuep2; + else + values[nb++] = (xmlChar *) atom->valuep; (*nbval)++; } } @@ -3305,7 +3313,10 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, if ((exec->comp->states[trans->to] != NULL) && (exec->comp->states[trans->to]->type == XML_REGEXP_SINK_STATE)) { - values[nb++] = (xmlChar *) atom->valuep; + if (atom->neg) + values[nb++] = (xmlChar *) atom->valuep2; + else + values[nb++] = (xmlChar *) atom->valuep; (*nbneg)++; } } @@ -4766,6 +4777,7 @@ xmlAutomataNewNegTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, const xmlChar *token2, void *data) { xmlRegAtomPtr atom; + xmlChar err_msg[200]; if ((am == NULL) || (from == NULL) || (token == NULL)) return(NULL); @@ -4795,6 +4807,9 @@ xmlAutomataNewNegTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, atom->valuep = str; } + snprintf(err_msg, 199, "not %s", atom->valuep); + err_msg[199] = 0; + atom->valuep2 = xmlStrdup(err_msg); if (xmlFAGenerateTransitions(am, from, to, atom) < 0) { xmlRegFreeAtom(atom); diff --git a/xmlschemas.c b/xmlschemas.c index 821b48f7..70be413b 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -1879,7 +1879,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, xmlChar *str = NULL, *msg = NULL; xmlChar *localName, *nsName; const xmlChar *cur, *end; - int i; + int i, is_not; xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); @@ -1898,6 +1898,16 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, for (i = 0; i < nbval + nbneg; i++) { cur = values[i]; + if (cur == NULL) + continue; + if ((cur[0] == 'n') && (cur[1] == 'o') && (cur[2] == 't') && + (cur[3] == ' ')) { + is_not = 1; + cur += 4; + str = xmlStrcat(str, BAD_CAST "not "); + } else { + is_not = 0; + } /* * Get the local name. */ @@ -8679,6 +8689,7 @@ xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt, xmlSchemaParseInclude(ctxt, schema, child); ctxt->includes--; } else if (IS_SCHEMA(child, "redefine")) { + fprintf(stderr, "redefine is not yet implemented\n"); TODO } child = child->next;