Skip to content

Commit

Permalink
patched to redirrect all "out of context" error messages to
Browse files Browse the repository at this point in the history
a reconfigurable routine. The changes are:
* xmlerror.h : added the export of an error context type (void *)
  an error handler type xmlGenericErrorFunc there is an interface
  xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
  to reset the error handling routine and its argument
  (by default it's equivalent to respectively fprintf and stderr.
* all the c files: all wild accesses to stderr or stdout within
  the library have been replaced to calls to the handler.
Daniel
  • Loading branch information
Daniel Veillard committed Oct 25, 2000
1 parent 29a11cc commit d6d7f7b
Show file tree
Hide file tree
Showing 25 changed files with 1,715 additions and 901 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
@@ -1,3 +1,15 @@
Wed Oct 25 21:31:10 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>

* patched to redirrect all "out of context" error messages to
a reconfigurable routine. The changes are:
* xmlerror.h : added the export of an error context type (void *)
an error handler type xmlGenericErrorFunc there is an interface
xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
to reset the error handling routine and its argument
(by default it's equivalent to respectively fprintf and stderr.
* all the c files: all wild accesses to stderr or stdout within
the library have been replaced to calls to the handler.

Wed Oct 25 15:27:19 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>

* configure.in: release 2.2.6
Expand Down
291 changes: 184 additions & 107 deletions HTMLparser.c

Large diffs are not rendered by default.

37 changes: 25 additions & 12 deletions HTMLtree.c
Expand Up @@ -31,6 +31,7 @@
#include <libxml/HTMLtree.h>
#include <libxml/entities.h>
#include <libxml/valid.h>
#include <libxml/xmlerror.h>

/************************************************************************
* *
Expand Down Expand Up @@ -335,7 +336,8 @@ htmlDtdDump(xmlBufferPtr buf, xmlDocPtr doc) {
xmlDtdPtr cur = doc->intSubset;

if (cur == NULL) {
fprintf(stderr, "htmlDtdDump : no internal subset\n");
xmlGenericError(xmlGenericErrorContext,
"htmlDtdDump : no internal subset\n");
return;
}
xmlBufferWriteChar(buf, "<!DOCTYPE ");
Expand Down Expand Up @@ -367,7 +369,8 @@ htmlAttrDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
xmlChar *value;

if (cur == NULL) {
fprintf(stderr, "htmlAttrDump : property == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlAttrDump : property == NULL\n");
return;
}
xmlBufferWriteChar(buf, " ");
Expand Down Expand Up @@ -395,7 +398,8 @@ htmlAttrDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
static void
htmlAttrListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
if (cur == NULL) {
fprintf(stderr, "htmlAttrListDump : property == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlAttrListDump : property == NULL\n");
return;
}
while (cur != NULL) {
Expand All @@ -418,7 +422,8 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur);
static void
htmlNodeListDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
if (cur == NULL) {
fprintf(stderr, "htmlNodeListDump : node == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlNodeListDump : node == NULL\n");
return;
}
while (cur != NULL) {
Expand All @@ -440,7 +445,8 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
htmlElemDescPtr info;

if (cur == NULL) {
fprintf(stderr, "htmlNodeDump : node == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlNodeDump : node == NULL\n");
return;
}
/*
Expand Down Expand Up @@ -624,7 +630,8 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {

if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "htmlxmlDocDumpMemory : document == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlxmlDocDumpMemory : document == NULL\n");
#endif
*mem = NULL;
*size = 0;
Expand Down Expand Up @@ -665,7 +672,8 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, const char *encoding) {
xmlDtdPtr cur = doc->intSubset;

if (cur == NULL) {
fprintf(stderr, "htmlDtdDump : no internal subset\n");
xmlGenericError(xmlGenericErrorContext,
"htmlDtdDump : no internal subset\n");
return;
}
xmlOutputBufferWriteString(buf, "<!DOCTYPE ");
Expand Down Expand Up @@ -697,7 +705,8 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, const
xmlChar *value;

if (cur == NULL) {
fprintf(stderr, "htmlAttrDump : property == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlAttrDump : property == NULL\n");
return;
}
xmlOutputBufferWriteString(buf, " ");
Expand Down Expand Up @@ -725,7 +734,8 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, const
static void
htmlAttrListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, const char *encoding) {
if (cur == NULL) {
fprintf(stderr, "htmlAttrListDump : property == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlAttrListDump : property == NULL\n");
return;
}
while (cur != NULL) {
Expand All @@ -749,7 +759,8 @@ void htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
static void
htmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const char *encoding) {
if (cur == NULL) {
fprintf(stderr, "htmlNodeListDump : node == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlNodeListDump : node == NULL\n");
return;
}
while (cur != NULL) {
Expand All @@ -771,7 +782,8 @@ htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const
htmlElemDescPtr info;

if (cur == NULL) {
fprintf(stderr, "htmlNodeDump : node == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlNodeDump : node == NULL\n");
return;
}
/*
Expand Down Expand Up @@ -971,7 +983,8 @@ htmlDocDump(FILE *f, xmlDocPtr cur) {

if (cur == NULL) {
#ifdef DEBUG_TREE
fprintf(stderr, "htmlDocDump : document == NULL\n");
xmlGenericError(xmlGenericErrorContext,
"htmlDocDump : document == NULL\n");
#endif
return(-1);
}
Expand Down

0 comments on commit d6d7f7b

Please sign in to comment.