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/ChangeLog b/ChangeLog
index 8a8411f..f894b03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Jul 18 17:11:42 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+ * 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.
+
Wed Jul 16 23:15:53 CEST 2003 Daniel Veillard <daniel@veillard.com>
* parserInternals.c: patch from Dodji Seketeli about UTF16 BOM
diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h
index 46848cb..929d0e6 100644
--- a/include/libxml/relaxng.h
+++ b/include/libxml/relaxng.h
@@ -88,6 +88,10 @@
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
+int xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
+ xmlRelaxNGValidityErrorFunc *err,
+ xmlRelaxNGValidityWarningFunc *warn,
+ void **ctx);
xmlRelaxNGPtr xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
void xmlRelaxNGFree (xmlRelaxNGPtr schema);
void xmlRelaxNGDump (FILE *output,
@@ -101,6 +105,10 @@
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
+int xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
+ xmlRelaxNGValidityErrorFunc *err,
+ xmlRelaxNGValidityWarningFunc *warn,
+ void **ctx);
xmlRelaxNGValidCtxtPtr xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
void xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
int xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
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
diff --git a/xmlreader.c b/xmlreader.c
index 20ff753..031e054 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -770,6 +770,9 @@
((oldstate == XML_TEXTREADER_BACKTRACK) ||
(reader->node->children == NULL) ||
(reader->node->type == XML_ENTITY_REF_NODE) ||
+ ((reader->node->children != NULL) &&
+ (reader->node->children->type == XML_TEXT_NODE) &&
+ (reader->node->children->next == NULL)) ||
(reader->node->type == XML_DTD_NODE) ||
(reader->node->type == XML_DOCUMENT_NODE) ||
(reader->node->type == XML_HTML_DOCUMENT_NODE)) &&