summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2003-08-26 13:56:48 +0000
committerDaniel Veillard <veillard@src.gnome.org>2003-08-26 13:56:48 +0000
commitc1ffa0ab97d0724acfc947e20873959da72b1b5d (patch)
tree18d5f9602c6dbe8e3b6197ecf011b0ac35217b41
parent68f8fad71e7d07f09c14d222861e0a2f767bbf6c (diff)
downloadlibxml2-c1ffa0ab97d0724acfc947e20873959da72b1b5d.tar.gz
fixed bug #120386 again a problem introduced when trying to reuse automata
* relaxng.c: fixed bug #120386 again a problem introduced when trying to reuse automata for content validation. Fix a bug report problem on zeroOrMore * result/relaxng/tutor3_7_err: change slightly error reporting. Daniel
-rw-r--r--ChangeLog7
-rw-r--r--relaxng.c19
-rw-r--r--result/relaxng/tutor3_7_err2
3 files changed, 28 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f1c77418..50b75d05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Aug 26 15:54:04 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+ * relaxng.c: fixed bug #120386 again a problem introduced when
+ trying to reuse automata for content validation. Fix a bug report
+ problem on zeroOrMore
+ * result/relaxng/tutor3_7_err: change slightly error reporting.
+
Mon Aug 25 13:24:57 CEST 2003 Daniel Veillard <daniel@veillard.com>
* include/libxml/Makefile.am: make sure the new header will
diff --git a/relaxng.c b/relaxng.c
index cdcc0798..28d1a606 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -365,6 +365,8 @@ struct _xmlRelaxNGValidCtxt {
int pstate; /* progressive state */
xmlNodePtr pnode; /* the current node */
xmlRelaxNGDefinePtr pdef; /* the non-streamable definition */
+ int perr; /* signal error in content model
+ outside the regexp */
};
/**
@@ -7690,6 +7692,8 @@ xmlRelaxNGValidateCompiledCallback(xmlRegExecCtxtPtr exec ATTRIBUTE_UNUSED,
return;
}
ret = xmlRelaxNGValidateDefinition(ctxt, define);
+ if (ret != 0)
+ ctxt->perr = ret;
}
/**
@@ -7708,11 +7712,13 @@ xmlRelaxNGValidateCompiledContent(xmlRelaxNGValidCtxtPtr ctxt,
xmlRegExecCtxtPtr exec;
xmlNodePtr cur;
int ret = 0;
+ int oldperr = ctxt->perr;
if ((ctxt == NULL) || (regexp == NULL))
return(-1);
exec = xmlRegNewExecCtxt(regexp,
xmlRelaxNGValidateCompiledCallback, ctxt);
+ ctxt->perr = 0;
cur = content;
while (cur != NULL) {
ctxt->state->seq = cur;
@@ -7762,6 +7768,14 @@ xmlRelaxNGValidateCompiledContent(xmlRelaxNGValidCtxtPtr ctxt,
ret = -1;
}
xmlRegFreeExecCtxt(exec);
+ /*
+ * There might be content model errors outside of the pure
+ * regexp validation, e.g. for attribute values.
+ */
+ if ((ret == 0) && (ctxt->perr != 0)) {
+ ret = ctxt->perr;
+ }
+ ctxt->perr = oldperr;
return(ret);
}
@@ -9777,8 +9791,13 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt,
}
ctxt->states = res;
ctxt->flags = oldflags;
+#if 0
+ /*
+ * errors may have to be propagated back...
+ */
if (ctxt->errNr > errNr)
xmlRelaxNGPopErrors(ctxt, errNr);
+#endif
ret = 0;
break;
}
diff --git a/result/relaxng/tutor3_7_err b/result/relaxng/tutor3_7_err
index 24088bbf..b30a3c49 100644
--- a/result/relaxng/tutor3_7_err
+++ b/result/relaxng/tutor3_7_err
@@ -1,4 +1,6 @@
RNG validity error: file ./test/relaxng/tutor3_7.rng line 1 element element
+Expecting an element , got nothing
+RNG validity error: file ./test/relaxng/tutor3_7.rng line 1 element element
Invalid sequence in interleave
RNG validity error: file ./test/relaxng/tutor3_7.rng line 1 element element
Element element failed to validate content