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
This commit is contained in:
Daniel Veillard 2003-07-18 15:16:57 +00:00
parent 2dcb937a9a
commit 409a8147c1
4 changed files with 66 additions and 0 deletions

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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)) &&