Index: parser.c =================================================================== RCS file: /cvs/gnome/gnome-xml/parser.c,v retrieving revision 1.342 diff -u -r1.342 parser.c --- parser.c 30 Oct 2003 22:13:02 -0000 1.342 +++ parser.c 31 Oct 2003 09:22:23 -0000 @@ -141,6 +141,9 @@ xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar * prefix, const xmlChar * localname) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED; if (prefix == NULL) __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, @@ -171,6 +174,9 @@ { const char *errmsg; + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; switch (error) { case XML_ERR_INVALID_HEX_CHARREF: errmsg = "CharRef: invalid hexadecimal value\n"; @@ -371,6 +377,9 @@ xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); @@ -395,6 +404,9 @@ { xmlStructuredErrorFunc schannel = NULL; + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) schannel = ctxt->sax->serror; @@ -421,6 +433,10 @@ const char *msg, const xmlChar *str1) { xmlStructuredErrorFunc schannel = NULL; + + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) schannel = ctxt->sax->serror; @@ -446,6 +462,9 @@ xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, int val) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, @@ -471,6 +490,9 @@ const char *msg, const xmlChar *str1, int val, const xmlChar *str2) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, @@ -494,6 +516,9 @@ xmlFatalErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar * val) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, @@ -517,6 +542,9 @@ xmlErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar * val) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_ERROR, @@ -540,6 +568,9 @@ const xmlChar * info1, const xmlChar * info2, const xmlChar * info3) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, XML_ERR_ERROR, NULL, 0, (const char *) info1, @@ -10126,7 +10157,10 @@ */ void xmlStopParser(xmlParserCtxtPtr ctxt) { + if (ctxt == NULL) + return; ctxt->instate = XML_PARSER_EOF; + ctxt->disableSAX = 1; if (ctxt->input != NULL) ctxt->input->cur = BAD_CAST""; } Index: parserInternals.c =================================================================== RCS file: /cvs/gnome/gnome-xml/parserInternals.c,v retrieving revision 1.100 diff -u -r1.100 parserInternals.c --- parserInternals.c 27 Oct 2003 11:25:13 -0000 1.100 +++ parserInternals.c 31 Oct 2003 09:22:23 -0000 @@ -105,6 +105,9 @@ void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; if (ctxt != NULL) { ctxt->errNo = XML_ERR_NO_MEMORY; ctxt->instate = XML_PARSER_EOF; @@ -135,6 +138,9 @@ __xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar * str1, const xmlChar * str2) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, @@ -159,6 +165,9 @@ static void xmlErrInternal(xmlParserCtxtPtr ctxt, const char *msg, const xmlChar * str) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; if (ctxt != NULL) ctxt->errNo = XML_ERR_INTERNAL_ERROR; __xmlRaiseError(NULL, NULL, NULL, @@ -185,6 +194,9 @@ xmlErrEncodingInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, int val) { + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, Index: xmlIO.c =================================================================== RCS file: /cvs/gnome/gnome-xml/xmlIO.c,v retrieving revision 1.134 diff -u -r1.134 xmlIO.c --- xmlIO.c 29 Oct 2003 22:15:13 -0000 1.134 +++ xmlIO.c 31 Oct 2003 09:22:24 -0000 @@ -409,6 +409,9 @@ void *data = NULL; xmlErrorLevel level = XML_ERR_ERROR; + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; if ((ctxt != NULL) && (ctxt->sax != NULL)) { if (ctxt->validate) { channel = ctxt->sax->error;