diff --git a/ChangeLog b/ChangeLog index 8a8411fb..f894b031 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Jul 18 17:11:42 CEST 2003 Daniel Veillard + + * 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 * parserInternals.c: patch from Dodji Seketeli about UTF16 BOM diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h index 46848cb8..929d0e64 100644 --- a/include/libxml/relaxng.h +++ b/include/libxml/relaxng.h @@ -88,6 +88,10 @@ void xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, 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 @@ void xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, 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 1813b601..28eef440 100644 --- a/relaxng.c +++ b/relaxng.c @@ -7304,6 +7304,30 @@ xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, 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 * @@ -10281,6 +10305,29 @@ xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, ctxt->userData = ctx; } +/** + * 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 diff --git a/xmlreader.c b/xmlreader.c index 20ff7530..031e054c 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -770,6 +770,9 @@ get_next_node: ((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)) &&