adding Get interface for the error callback and parameters of parsing and
* relaxng.c include/libxml/relaxng.h: adding Get interface for
the error callback and parameters of parsing and validation
contexts
* xmlreader.c: patch to fix bug #117702 about incomplete Read()
on text nodes.
Daniel
diff --git a/relaxng.c b/relaxng.c
index 1813b60..28eef44 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -7304,6 +7304,30 @@
ctxt->warning = warn;
ctxt->userData = ctx;
}
+
+/**
+ * xmlRelaxNGGetParserErrors:
+ * @ctxt: a Relax-NG validation context
+ * @err: the error callback result
+ * @warn: the warning callback result
+ * @ctx: contextual data for the callbacks result
+ *
+ * Get the callback information used to handle errors for a validation context
+ *
+ * Returns -1 in case of failure, 0 otherwise.
+ */
+int
+xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
+ xmlRelaxNGValidityErrorFunc *err,
+ xmlRelaxNGValidityWarningFunc *warn, void **ctx) {
+ if (ctxt == NULL)
+ return(-1);
+ if (err != NULL) *err = ctxt->error;
+ if (warn != NULL) *warn = ctxt->warning;
+ if (ctx != NULL) *ctx = ctxt->userData;
+ return(0);
+}
+
/************************************************************************
* *
* Dump back a compiled form *
@@ -10282,6 +10306,29 @@
}
/**
+ * xmlRelaxNGGetValidErrors:
+ * @ctxt: a Relax-NG validation context
+ * @err: the error function result
+ * @warn: the warning function result
+ * @ctx: the functions context result
+ *
+ * Get the error and warning callback informations
+ *
+ * Returns -1 in case of error and 0 otherwise
+ */
+int
+xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
+ xmlRelaxNGValidityErrorFunc *err,
+ xmlRelaxNGValidityWarningFunc *warn, void **ctx) {
+ if (ctxt == NULL)
+ return(-1);
+ if (err != NULL) *err = ctxt->error;
+ if (warn != NULL) *warn = ctxt->warning;
+ if (ctx != NULL) *ctx = ctxt->userData;
+ return(0);
+}
+
+/**
* xmlRelaxNGValidateDoc:
* @ctxt: a Relax-NG validation context
* @doc: a parsed document tree