diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2004-11-03 14:20:29 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2004-11-03 14:20:29 +0000 |
commit | dd6d300896cfeacbacf7c5bceb5bec2f36790efe (patch) | |
tree | 9a41869c9b442d1489219cdb49c2d3ae863d3459 /xmlwriter.c | |
parent | e43cc574e49cd8173e157d8c31973f709a4cb7ec (diff) | |
download | libxml2-dd6d300896cfeacbacf7c5bceb5bec2f36790efe.tar.gz |
more fixes and extending the tests coverage adding a type init interface
* gentest.py testapi.c: more fixes and extending the tests coverage
* relaxng.c include/libxml/relaxng.h: adding a type init interface
* include/libxml/xmlerror.h parser.c xmlreader.c xmlwriter.c: more
cleanups and bug fixes raised by the regression tests
Daniel
Diffstat (limited to 'xmlwriter.c')
-rw-r--r-- | xmlwriter.c | 164 |
1 files changed, 103 insertions, 61 deletions
diff --git a/xmlwriter.c b/xmlwriter.c index d4c71760..a11ef25e 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -96,6 +96,51 @@ static int xmlTextWriterStackEntry * p); /** + * xmlWriterErrMsg: + * @ctxt: a writer context + * @error: the error number + * @msg: the error message + * + * Handle a writer error + */ +static void +xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error, + const char *msg) +{ + if (ctxt != NULL) { + __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, + NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, + NULL, 0, NULL, NULL, NULL, 0, 0, msg); + } else { + __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, + XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); + } +} + +/** + * xmlWriterErrMsgInt: + * @ctxt: a writer context + * @error: the error number + * @msg: the error message + * @val: an int + * + * Handle a writer error + */ +static void +xmlWriterErrMsgInt(xmlTextWriterPtr ctxt, xmlParserErrors error, + const char *msg, int val) +{ + if (ctxt != NULL) { + __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, + NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, + NULL, 0, NULL, NULL, NULL, val, 0, msg, val); + } else { + __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, + XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, val, 0, msg, val); + } +} + +/** * xmlNewTextWriter: * @out: an xmlOutputBufferPtr * @@ -110,7 +155,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) ret = (xmlTextWriterPtr) xmlMalloc(sizeof(xmlTextWriter)); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); return NULL; } @@ -121,7 +166,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) (xmlListDataCompare) xmlCmpTextWriterStackEntry); if (ret->nodes == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); xmlFree(ret); return NULL; @@ -132,7 +177,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) (xmlListDataCompare) xmlCmpTextWriterNsStackEntry); if (ret->nsstack == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); xmlListDelete(ret->nodes); xmlFree(ret); @@ -147,7 +192,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) xmlListDelete(ret->nodes); xmlListDelete(ret->nsstack); xmlFree(ret); - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); return NULL; } @@ -172,14 +217,14 @@ xmlNewTextWriterFilename(const char *uri, int compression) out = xmlOutputBufferCreateFilename(uri, NULL, compression); if (out == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterFilename : out of memory!\n"); return NULL; } ret = xmlNewTextWriter(out); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterFilename : out of memory!\n"); xmlOutputBufferClose(out); return NULL; @@ -213,14 +258,14 @@ xmlNewTextWriterMemory(xmlBufferPtr buf, int compression ATTRIBUTE_UNUSED) xmlTextWriterCloseMemCallback, (void *) buf, NULL); if (out == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterMemory : out of memory!\n"); return NULL; } ret = xmlNewTextWriter(out); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterMemory : out of memory!\n"); xmlOutputBufferClose(out); return NULL; @@ -247,7 +292,7 @@ xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, xmlOutputBufferPtr out; if (ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterPushParser : invalid context!\n"); return NULL; } @@ -258,14 +303,14 @@ xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, xmlTextWriterCloseDocCallback, (void *) ctxt, NULL); if (out == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterPushParser : error at xmlOutputBufferCreateIO!\n"); return NULL; } ret = xmlNewTextWriter(out); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterPushParser : error at xmlNewTextWriter!\n"); xmlOutputBufferClose(out); return NULL; @@ -300,7 +345,7 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression) ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL); if (ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n"); return NULL; } @@ -313,14 +358,14 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression) ctxt->myDoc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION); if (ctxt->myDoc == NULL) { xmlFreeParserCtxt(ctxt); - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlNewDoc!\n"); return NULL; } ret = xmlNewTextWriterPushParser(ctxt, compression); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n"); return NULL; } @@ -352,7 +397,7 @@ xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression) xmlParserCtxtPtr ctxt; if (doc == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterTree : invalid document tree!\n"); return NULL; } @@ -365,7 +410,7 @@ xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression) ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL); if (ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n"); return NULL; } @@ -378,7 +423,7 @@ xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression) ret = xmlNewTextWriterPushParser(ctxt, compression); if (ret == NULL) { xmlFreeParserCtxt(ctxt); - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n"); return NULL; } @@ -441,14 +486,14 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, xmlCharEncodingHandlerPtr encoder; if ((writer == NULL) || (writer->out == NULL)) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDocument : invalid writer!\n"); return -1; } lk = xmlListFront(writer->nodes); if ((lk != NULL) && (xmlLinkGetData(lk) != NULL)) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDocument : not allowed in this context!\n"); return -1; } @@ -457,7 +502,7 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, if (encoding != NULL) { encoder = xmlFindCharEncodingHandler(encoding); if (encoder == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDocument : out of memory!\n"); return -1; } @@ -555,7 +600,7 @@ xmlTextWriterEndDocument(xmlTextWriterPtr writer) xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterEndDocument : invalid writer!\n"); return -1; } @@ -638,7 +683,7 @@ xmlTextWriterStartComment(xmlTextWriterPtr writer) xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartComment : invalid writer!\n"); return -1; } @@ -675,7 +720,7 @@ xmlTextWriterStartComment(xmlTextWriterPtr writer) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartElement : out of memory!\n"); return -1; } @@ -717,14 +762,14 @@ xmlTextWriterEndComment(xmlTextWriterPtr writer) xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterEndComment : invalid writer!\n"); return -1; } lk = xmlListFront(writer->nodes); if (lk == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterEndComment : not allowed in this context!\n"); return -1; } @@ -799,7 +844,7 @@ xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, xmlChar *buf; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteVFormatComment : invalid writer!\n"); return -1; } @@ -896,14 +941,14 @@ xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartElement : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartElement : out of memory!\n"); xmlFree(p); return -1; @@ -1201,13 +1246,13 @@ xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content, xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteRawLen : invalid writer!\n"); return -1; } if ((content == NULL) || (len < 0)) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteRawLen : invalid content!\n"); return -1; } @@ -1704,7 +1749,7 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, p = (xmlTextWriterNsStackEntry *) xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartAttributeNS : out of memory!\n"); return -1; } @@ -1712,7 +1757,7 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, p->prefix = buf; p->uri = xmlStrdup(namespaceURI); if (p->uri == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartAttributeNS : out of memory!\n"); xmlFree(p); return -1; @@ -2241,7 +2286,7 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) return -1; if (xmlStrcasecmp(target, (const xmlChar *) "xml") == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartPI : target name [Xx][Mm][Ll] is reserved for xml standardization!\n"); return -1; } @@ -2271,7 +2316,7 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) break; case XML_TEXTWRITER_PI: case XML_TEXTWRITER_PI_TEXT: - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartPI : nested PI!\n"); return -1; default: @@ -2283,14 +2328,14 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartPI : out of memory!\n"); return -1; } p->name = xmlStrdup(target); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartPI : out of memory!\n"); xmlFree(p); return -1; @@ -2493,7 +2538,7 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) p->state = XML_TEXTWRITER_TEXT; break; case XML_TEXTWRITER_CDATA: - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartCDATA : CDATA not allowed in this context!\n"); return -1; default: @@ -2505,7 +2550,7 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartCDATA : out of memory!\n"); return -1; } @@ -2682,7 +2727,7 @@ xmlTextWriterStartDTD(xmlTextWriterPtr writer, sum = 0; lk = xmlListFront(writer->nodes); if ((lk != NULL) && (xmlLinkGetData(lk) != NULL)) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDTD : DTD allowed only in prolog!\n"); return -1; } @@ -2690,14 +2735,14 @@ xmlTextWriterStartDTD(xmlTextWriterPtr writer, p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTD : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTD : out of memory!\n"); xmlFree(p); return -1; @@ -2717,7 +2762,7 @@ xmlTextWriterStartDTD(xmlTextWriterPtr writer, if (pubid != 0) { if (sysid == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDTD : system identifier needed!\n"); return -1; } @@ -3029,14 +3074,14 @@ xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, const xmlChar * name) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); xmlFree(p); return -1; @@ -3266,14 +3311,14 @@ xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDAttlist : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDAttlist : out of memory!\n"); xmlFree(p); return -1; @@ -3505,14 +3550,14 @@ xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); xmlFree(p); return -1; @@ -3824,7 +3869,7 @@ xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: xmlTextWriterPtr invalid!\n"); return -1; } @@ -3832,7 +3877,7 @@ xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, sum = 0; lk = xmlListFront(writer->nodes); if (lk == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: you must call xmlTextWriterStartDTDEntity before the call to this function!\n"); return -1; } @@ -3846,20 +3891,20 @@ xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, break; case XML_TEXTWRITER_DTD_PENT: if (ndataid != NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: notation not allowed with parameter entities!\n"); return -1; } break; default: - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: you must call xmlTextWriterStartDTDEntity before the call to this function!\n"); return -1; } if (pubid != 0) { if (sysid == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: system identifier needed!\n"); return -1; } @@ -4248,7 +4293,7 @@ xmlTextWriterWriteDocCallback(void *context, const xmlChar * str, int len) int rc; if ((rc = xmlParseChunk(ctxt, (const char *) str, len, 0)) != 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDocCallback : XML error %d !\n", rc); return -1; @@ -4272,7 +4317,7 @@ xmlTextWriterCloseDocCallback(void *context) int rc; if ((rc = xmlParseChunk(ctxt, NULL, 0, 1)) != 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDocCallback : XML error %d !\n", rc); return -1; @@ -4300,7 +4345,7 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) size = BUFSIZ; buf = (xmlChar *) xmlMalloc(size); if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlTextWriterVSprintf : out of memory!\n"); return NULL; } @@ -4311,7 +4356,7 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) size += BUFSIZ; buf = (xmlChar *) xmlMalloc(size); if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlTextWriterVSprintf : out of memory!\n"); return NULL; } @@ -4332,9 +4377,6 @@ xmlTextWriterStartDocumentCallback(void *ctx) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlDocPtr doc; -#ifdef DEBUG_SAX - xmlGenericError(xmlGenericErrorContext, "SAX.startDocument()\n"); -#endif if (ctxt->html) { #ifdef LIBXML_HTML_ENABLED if (ctxt->myDoc == NULL) @@ -4349,7 +4391,7 @@ xmlTextWriterStartDocumentCallback(void *ctx) return; } #else - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "libxml2 built without HTML support\n"); ctxt->errNo = XML_ERR_INTERNAL_ERROR; ctxt->instate = XML_PARSER_EOF; |