OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * xmlwriter.c: XML text writer implementation | 3 * xmlwriter.c: XML text writer implementation |
4 * | 4 * |
5 * For license and disclaimer see the license and disclaimer of | 5 * For license and disclaimer see the license and disclaimer of |
6 * libxml2. | 6 * libxml2. |
7 * | 7 * |
8 * alfred@mickautsch.de | 8 * alfred@mickautsch.de |
9 */ | 9 */ |
10 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 * | 122 * |
123 * Handle a writer error | 123 * Handle a writer error |
124 */ | 124 */ |
125 static void | 125 static void |
126 xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error, | 126 xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error, |
127 const char *msg) | 127 const char *msg) |
128 { | 128 { |
129 if (ctxt != NULL) { | 129 if (ctxt != NULL) { |
130 __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, | 130 __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, |
131 NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, | 131 NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, |
132 » » NULL, 0, NULL, NULL, NULL, 0, 0, msg); | 132 » » NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg); |
133 } else { | 133 } else { |
134 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, | 134 __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, |
135 XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); | 135 XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg); |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 /** | 139 /** |
140 * xmlWriterErrMsgInt: | 140 * xmlWriterErrMsgInt: |
141 * @ctxt: a writer context | 141 * @ctxt: a writer context |
142 * @error: the error number | 142 * @error: the error number |
143 * @msg: the error message | 143 * @msg: the error message |
144 * @val: an int | 144 * @val: an int |
145 * | 145 * |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 * Returns the new xmlTextWriterPtr or NULL in case of error | 235 * Returns the new xmlTextWriterPtr or NULL in case of error |
236 */ | 236 */ |
237 xmlTextWriterPtr | 237 xmlTextWriterPtr |
238 xmlNewTextWriterFilename(const char *uri, int compression) | 238 xmlNewTextWriterFilename(const char *uri, int compression) |
239 { | 239 { |
240 xmlTextWriterPtr ret; | 240 xmlTextWriterPtr ret; |
241 xmlOutputBufferPtr out; | 241 xmlOutputBufferPtr out; |
242 | 242 |
243 out = xmlOutputBufferCreateFilename(uri, NULL, compression); | 243 out = xmlOutputBufferCreateFilename(uri, NULL, compression); |
244 if (out == NULL) { | 244 if (out == NULL) { |
245 xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, | 245 xmlWriterErrMsg(NULL, XML_IO_EIO, |
246 "xmlNewTextWriterFilename : out of memory!\n"); | 246 "xmlNewTextWriterFilename : cannot open uri\n"); |
247 return NULL; | 247 return NULL; |
248 } | 248 } |
249 | 249 |
250 ret = xmlNewTextWriter(out); | 250 ret = xmlNewTextWriter(out); |
251 if (ret == NULL) { | 251 if (ret == NULL) { |
252 xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, | 252 xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, |
253 "xmlNewTextWriterFilename : out of memory!\n"); | 253 "xmlNewTextWriterFilename : out of memory!\n"); |
254 xmlOutputBufferClose(out); | 254 xmlOutputBufferClose(out); |
255 return NULL; | 255 return NULL; |
256 } | 256 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 memset(&saxHandler, '\0', sizeof(saxHandler)); | 364 memset(&saxHandler, '\0', sizeof(saxHandler)); |
365 xmlSAX2InitDefaultSAXHandler(&saxHandler, 1); | 365 xmlSAX2InitDefaultSAXHandler(&saxHandler, 1); |
366 saxHandler.startDocument = xmlTextWriterStartDocumentCallback; | 366 saxHandler.startDocument = xmlTextWriterStartDocumentCallback; |
367 saxHandler.startElement = xmlSAX2StartElement; | 367 saxHandler.startElement = xmlSAX2StartElement; |
368 saxHandler.endElement = xmlSAX2EndElement; | 368 saxHandler.endElement = xmlSAX2EndElement; |
369 | 369 |
370 ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL); | 370 ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL); |
371 if (ctxt == NULL) { | 371 if (ctxt == NULL) { |
372 xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, | 372 xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, |
373 "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!
\n"); | 373 "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n"); |
374 return NULL; | 374 return NULL; |
375 } | 375 } |
376 /* | 376 /* |
377 * For some reason this seems to completely break if node names | 377 * For some reason this seems to completely break if node names |
378 * are interned. | 378 * are interned. |
379 */ | 379 */ |
380 ctxt->dictNames = 0; | 380 ctxt->dictNames = 0; |
381 | 381 |
382 ctxt->myDoc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION); | 382 ctxt->myDoc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION); |
383 if (ctxt->myDoc == NULL) { | 383 if (ctxt->myDoc == NULL) { |
384 xmlFreeParserCtxt(ctxt); | 384 xmlFreeParserCtxt(ctxt); |
385 xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, | 385 xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, |
386 "xmlNewTextWriterDoc : error at xmlNewDoc!\n"); | 386 "xmlNewTextWriterDoc : error at xmlNewDoc!\n"); |
387 return NULL; | 387 return NULL; |
388 } | 388 } |
389 | 389 |
390 ret = xmlNewTextWriterPushParser(ctxt, compression); | 390 ret = xmlNewTextWriterPushParser(ctxt, compression); |
391 if (ret == NULL) { | 391 if (ret == NULL) { |
| 392 xmlFreeDoc(ctxt->myDoc); |
| 393 xmlFreeParserCtxt(ctxt); |
392 xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, | 394 xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, |
393 "xmlNewTextWriterDoc : error at xmlNewTextWriterPushPars
er!\n"); | 395 "xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n"); |
394 return NULL; | 396 return NULL; |
395 } | 397 } |
396 | 398 |
397 xmlSetDocCompressMode(ctxt->myDoc, compression); | 399 xmlSetDocCompressMode(ctxt->myDoc, compression); |
398 | 400 |
399 if (doc != NULL) { | 401 if (doc != NULL) { |
400 *doc = ctxt->myDoc; | 402 *doc = ctxt->myDoc; |
401 ret->no_doc_free = 1; | 403 ret->no_doc_free = 1; |
402 } | 404 } |
403 | 405 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 int rc; | 893 int rc; |
892 xmlChar *buf; | 894 xmlChar *buf; |
893 | 895 |
894 if (writer == NULL) { | 896 if (writer == NULL) { |
895 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, | 897 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, |
896 "xmlTextWriterWriteVFormatComment : invalid writer!\n"); | 898 "xmlTextWriterWriteVFormatComment : invalid writer!\n"); |
897 return -1; | 899 return -1; |
898 } | 900 } |
899 | 901 |
900 buf = xmlTextWriterVSprintf(format, argptr); | 902 buf = xmlTextWriterVSprintf(format, argptr); |
901 if (buf == 0) | 903 if (buf == NULL) |
902 return 0; | 904 return -1; |
903 | 905 |
904 rc = xmlTextWriterWriteComment(writer, buf); | 906 rc = xmlTextWriterWriteComment(writer, buf); |
905 | 907 |
906 xmlFree(buf); | 908 xmlFree(buf); |
907 return rc; | 909 return rc; |
908 } | 910 } |
909 | 911 |
910 /** | 912 /** |
911 * xmlTextWriterWriteComment: | 913 * xmlTextWriterWriteComment: |
912 * @writer: the xmlTextWriterPtr | 914 * @writer: the xmlTextWriterPtr |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 /* Output namespace declarations */ | 1235 /* Output namespace declarations */ |
1234 count = xmlTextWriterOutputNSDecl(writer); | 1236 count = xmlTextWriterOutputNSDecl(writer); |
1235 if (count < 0) | 1237 if (count < 0) |
1236 return -1; | 1238 return -1; |
1237 sum += count; | 1239 sum += count; |
1238 | 1240 |
1239 count = xmlOutputBufferWriteString(writer->out, ">"); | 1241 count = xmlOutputBufferWriteString(writer->out, ">"); |
1240 if (count < 0) | 1242 if (count < 0) |
1241 return -1; | 1243 return -1; |
1242 sum += count; | 1244 sum += count; |
| 1245 if (writer->indent) |
| 1246 writer->doindent = 0; |
1243 /* fallthrough */ | 1247 /* fallthrough */ |
1244 case XML_TEXTWRITER_TEXT: | 1248 case XML_TEXTWRITER_TEXT: |
| 1249 if ((writer->indent) && (writer->doindent)) { |
| 1250 count = xmlTextWriterWriteIndent(writer); |
| 1251 sum += count; |
| 1252 writer->doindent = 1; |
| 1253 } else |
| 1254 writer->doindent = 1; |
1245 count = xmlOutputBufferWriteString(writer->out, "</"); | 1255 count = xmlOutputBufferWriteString(writer->out, "</"); |
1246 if (count < 0) | 1256 if (count < 0) |
1247 return -1; | 1257 return -1; |
1248 sum += count; | 1258 sum += count; |
1249 count = xmlOutputBufferWriteString(writer->out, | 1259 count = xmlOutputBufferWriteString(writer->out, |
1250 (const char *) p->name); | 1260 (const char *) p->name); |
1251 if (count < 0) | 1261 if (count < 0) |
1252 return -1; | 1262 return -1; |
1253 sum += count; | 1263 sum += count; |
1254 count = xmlOutputBufferWriteString(writer->out, ">"); | 1264 count = xmlOutputBufferWriteString(writer->out, ">"); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format, | 1318 xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format, |
1309 va_list argptr) | 1319 va_list argptr) |
1310 { | 1320 { |
1311 int rc; | 1321 int rc; |
1312 xmlChar *buf; | 1322 xmlChar *buf; |
1313 | 1323 |
1314 if (writer == NULL) | 1324 if (writer == NULL) |
1315 return -1; | 1325 return -1; |
1316 | 1326 |
1317 buf = xmlTextWriterVSprintf(format, argptr); | 1327 buf = xmlTextWriterVSprintf(format, argptr); |
1318 if (buf == 0) | 1328 if (buf == NULL) |
1319 return 0; | 1329 return -1; |
1320 | 1330 |
1321 rc = xmlTextWriterWriteRaw(writer, buf); | 1331 rc = xmlTextWriterWriteRaw(writer, buf); |
1322 | 1332 |
1323 xmlFree(buf); | 1333 xmlFree(buf); |
1324 return rc; | 1334 return rc; |
1325 } | 1335 } |
1326 | 1336 |
1327 /** | 1337 /** |
1328 * xmlTextWriterWriteRawLen: | 1338 * xmlTextWriterWriteRawLen: |
1329 * @writer: the xmlTextWriterPtr | 1339 * @writer: the xmlTextWriterPtr |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer, | 1447 xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer, |
1438 const char *format, va_list argptr) | 1448 const char *format, va_list argptr) |
1439 { | 1449 { |
1440 int rc; | 1450 int rc; |
1441 xmlChar *buf; | 1451 xmlChar *buf; |
1442 | 1452 |
1443 if ((writer == NULL) || (format == NULL)) | 1453 if ((writer == NULL) || (format == NULL)) |
1444 return -1; | 1454 return -1; |
1445 | 1455 |
1446 buf = xmlTextWriterVSprintf(format, argptr); | 1456 buf = xmlTextWriterVSprintf(format, argptr); |
1447 if (buf == 0) | 1457 if (buf == NULL) |
1448 return 0; | 1458 return -1; |
1449 | 1459 |
1450 rc = xmlTextWriterWriteString(writer, buf); | 1460 rc = xmlTextWriterWriteString(writer, buf); |
1451 | 1461 |
1452 xmlFree(buf); | 1462 xmlFree(buf); |
1453 return rc; | 1463 return rc; |
1454 } | 1464 } |
1455 | 1465 |
1456 /** | 1466 /** |
1457 * xmlTextWriterWriteString: | 1467 * xmlTextWriterWriteString: |
1458 * @writer: the xmlTextWriterPtr | 1468 * @writer: the xmlTextWriterPtr |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 NULL, content); | 1505 NULL, content); |
1496 break; | 1506 break; |
1497 default: | 1507 default: |
1498 break; | 1508 break; |
1499 } | 1509 } |
1500 } | 1510 } |
1501 } | 1511 } |
1502 | 1512 |
1503 if (buf != NULL) { | 1513 if (buf != NULL) { |
1504 count = xmlTextWriterWriteRaw(writer, buf); | 1514 count = xmlTextWriterWriteRaw(writer, buf); |
| 1515 |
| 1516 if (buf != content) /* buf was allocated by us, so free it */ |
| 1517 xmlFree(buf); |
| 1518 |
1505 if (count < 0) | 1519 if (count < 0) |
1506 return -1; | 1520 return -1; |
1507 sum += count; | 1521 sum += count; |
1508 | |
1509 if (buf != content) /* buf was allocated by us, so free it */ | |
1510 xmlFree(buf); | |
1511 } | 1522 } |
1512 | 1523 |
1513 return sum; | 1524 return sum; |
1514 } | 1525 } |
1515 | 1526 |
1516 /** | 1527 /** |
1517 * xmlOutputBufferWriteBase64: | 1528 * xmlOutputBufferWriteBase64: |
1518 * @out: the xmlOutputBufferPtr | 1529 * @out: the xmlOutputBufferPtr |
1519 * @data: binary data | 1530 * @data: binary data |
1520 * @len: the number of bytes to encode | 1531 * @len: the number of bytes to encode |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 const xmlChar * name, | 1993 const xmlChar * name, |
1983 const char *format, va_list argptr) | 1994 const char *format, va_list argptr) |
1984 { | 1995 { |
1985 int rc; | 1996 int rc; |
1986 xmlChar *buf; | 1997 xmlChar *buf; |
1987 | 1998 |
1988 if (writer == NULL) | 1999 if (writer == NULL) |
1989 return -1; | 2000 return -1; |
1990 | 2001 |
1991 buf = xmlTextWriterVSprintf(format, argptr); | 2002 buf = xmlTextWriterVSprintf(format, argptr); |
1992 if (buf == 0) | 2003 if (buf == NULL) |
1993 return 0; | 2004 return -1; |
1994 | 2005 |
1995 rc = xmlTextWriterWriteAttribute(writer, name, buf); | 2006 rc = xmlTextWriterWriteAttribute(writer, name, buf); |
1996 | 2007 |
1997 xmlFree(buf); | 2008 xmlFree(buf); |
1998 return rc; | 2009 return rc; |
1999 } | 2010 } |
2000 | 2011 |
2001 /** | 2012 /** |
2002 * xmlTextWriterWriteAttribute: | 2013 * xmlTextWriterWriteAttribute: |
2003 * @writer: the xmlTextWriterPtr | 2014 * @writer: the xmlTextWriterPtr |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 const xmlChar * namespaceURI, | 2095 const xmlChar * namespaceURI, |
2085 const char *format, va_list argptr) | 2096 const char *format, va_list argptr) |
2086 { | 2097 { |
2087 int rc; | 2098 int rc; |
2088 xmlChar *buf; | 2099 xmlChar *buf; |
2089 | 2100 |
2090 if (writer == NULL) | 2101 if (writer == NULL) |
2091 return -1; | 2102 return -1; |
2092 | 2103 |
2093 buf = xmlTextWriterVSprintf(format, argptr); | 2104 buf = xmlTextWriterVSprintf(format, argptr); |
2094 if (buf == 0) | 2105 if (buf == NULL) |
2095 return 0; | 2106 return -1; |
2096 | 2107 |
2097 rc = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, | 2108 rc = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, |
2098 buf); | 2109 buf); |
2099 | 2110 |
2100 xmlFree(buf); | 2111 xmlFree(buf); |
2101 return rc; | 2112 return rc; |
2102 } | 2113 } |
2103 | 2114 |
2104 /** | 2115 /** |
2105 * xmlTextWriterWriteAttributeNS: | 2116 * xmlTextWriterWriteAttributeNS: |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 const xmlChar * name, const char *format, | 2196 const xmlChar * name, const char *format, |
2186 va_list argptr) | 2197 va_list argptr) |
2187 { | 2198 { |
2188 int rc; | 2199 int rc; |
2189 xmlChar *buf; | 2200 xmlChar *buf; |
2190 | 2201 |
2191 if (writer == NULL) | 2202 if (writer == NULL) |
2192 return -1; | 2203 return -1; |
2193 | 2204 |
2194 buf = xmlTextWriterVSprintf(format, argptr); | 2205 buf = xmlTextWriterVSprintf(format, argptr); |
2195 if (buf == 0) | 2206 if (buf == NULL) |
2196 return 0; | 2207 return -1; |
2197 | 2208 |
2198 rc = xmlTextWriterWriteElement(writer, name, buf); | 2209 rc = xmlTextWriterWriteElement(writer, name, buf); |
2199 | 2210 |
2200 xmlFree(buf); | 2211 xmlFree(buf); |
2201 return rc; | 2212 return rc; |
2202 } | 2213 } |
2203 | 2214 |
2204 /** | 2215 /** |
2205 * xmlTextWriterWriteElement: | 2216 * xmlTextWriterWriteElement: |
2206 * @writer: the xmlTextWriterPtr | 2217 * @writer: the xmlTextWriterPtr |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 const xmlChar * namespaceURI, | 2298 const xmlChar * namespaceURI, |
2288 const char *format, va_list argptr) | 2299 const char *format, va_list argptr) |
2289 { | 2300 { |
2290 int rc; | 2301 int rc; |
2291 xmlChar *buf; | 2302 xmlChar *buf; |
2292 | 2303 |
2293 if (writer == NULL) | 2304 if (writer == NULL) |
2294 return -1; | 2305 return -1; |
2295 | 2306 |
2296 buf = xmlTextWriterVSprintf(format, argptr); | 2307 buf = xmlTextWriterVSprintf(format, argptr); |
2297 if (buf == 0) | 2308 if (buf == NULL) |
2298 return 0; | 2309 return -1; |
2299 | 2310 |
2300 rc = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, | 2311 rc = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, |
2301 buf); | 2312 buf); |
2302 | 2313 |
2303 xmlFree(buf); | 2314 xmlFree(buf); |
2304 return rc; | 2315 return rc; |
2305 } | 2316 } |
2306 | 2317 |
2307 /** | 2318 /** |
2308 * xmlTextWriterWriteElementNS: | 2319 * xmlTextWriterWriteElementNS: |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2536 const xmlChar * target, const char *format, | 2547 const xmlChar * target, const char *format, |
2537 va_list argptr) | 2548 va_list argptr) |
2538 { | 2549 { |
2539 int rc; | 2550 int rc; |
2540 xmlChar *buf; | 2551 xmlChar *buf; |
2541 | 2552 |
2542 if (writer == NULL) | 2553 if (writer == NULL) |
2543 return -1; | 2554 return -1; |
2544 | 2555 |
2545 buf = xmlTextWriterVSprintf(format, argptr); | 2556 buf = xmlTextWriterVSprintf(format, argptr); |
2546 if (buf == 0) | 2557 if (buf == NULL) |
2547 return 0; | 2558 return -1; |
2548 | 2559 |
2549 rc = xmlTextWriterWritePI(writer, target, buf); | 2560 rc = xmlTextWriterWritePI(writer, target, buf); |
2550 | 2561 |
2551 xmlFree(buf); | 2562 xmlFree(buf); |
2552 return rc; | 2563 return rc; |
2553 } | 2564 } |
2554 | 2565 |
2555 /** | 2566 /** |
2556 * xmlTextWriterWritePI: | 2567 * xmlTextWriterWritePI: |
2557 * @writer: the xmlTextWriterPtr | 2568 * @writer: the xmlTextWriterPtr |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2749 xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format, | 2760 xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format, |
2750 va_list argptr) | 2761 va_list argptr) |
2751 { | 2762 { |
2752 int rc; | 2763 int rc; |
2753 xmlChar *buf; | 2764 xmlChar *buf; |
2754 | 2765 |
2755 if (writer == NULL) | 2766 if (writer == NULL) |
2756 return -1; | 2767 return -1; |
2757 | 2768 |
2758 buf = xmlTextWriterVSprintf(format, argptr); | 2769 buf = xmlTextWriterVSprintf(format, argptr); |
2759 if (buf == 0) | 2770 if (buf == NULL) |
2760 return 0; | 2771 return -1; |
2761 | 2772 |
2762 rc = xmlTextWriterWriteCDATA(writer, buf); | 2773 rc = xmlTextWriterWriteCDATA(writer, buf); |
2763 | 2774 |
2764 xmlFree(buf); | 2775 xmlFree(buf); |
2765 return rc; | 2776 return rc; |
2766 } | 2777 } |
2767 | 2778 |
2768 /** | 2779 /** |
2769 * xmlTextWriterWriteCDATA: | 2780 * xmlTextWriterWriteCDATA: |
2770 * @writer: the xmlTextWriterPtr | 2781 * @writer: the xmlTextWriterPtr |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 const xmlChar * sysid, | 3078 const xmlChar * sysid, |
3068 const char *format, va_list argptr) | 3079 const char *format, va_list argptr) |
3069 { | 3080 { |
3070 int rc; | 3081 int rc; |
3071 xmlChar *buf; | 3082 xmlChar *buf; |
3072 | 3083 |
3073 if (writer == NULL) | 3084 if (writer == NULL) |
3074 return -1; | 3085 return -1; |
3075 | 3086 |
3076 buf = xmlTextWriterVSprintf(format, argptr); | 3087 buf = xmlTextWriterVSprintf(format, argptr); |
3077 if (buf == 0) | 3088 if (buf == NULL) |
3078 return 0; | 3089 return -1; |
3079 | 3090 |
3080 rc = xmlTextWriterWriteDTD(writer, name, pubid, sysid, buf); | 3091 rc = xmlTextWriterWriteDTD(writer, name, pubid, sysid, buf); |
3081 | 3092 |
3082 xmlFree(buf); | 3093 xmlFree(buf); |
3083 return rc; | 3094 return rc; |
3084 } | 3095 } |
3085 | 3096 |
3086 /** | 3097 /** |
3087 * xmlTextWriterWriteDTD: | 3098 * xmlTextWriterWriteDTD: |
3088 * @writer: the xmlTextWriterPtr | 3099 * @writer: the xmlTextWriterPtr |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3305 const xmlChar * name, | 3316 const xmlChar * name, |
3306 const char *format, va_list argptr) | 3317 const char *format, va_list argptr) |
3307 { | 3318 { |
3308 int rc; | 3319 int rc; |
3309 xmlChar *buf; | 3320 xmlChar *buf; |
3310 | 3321 |
3311 if (writer == NULL) | 3322 if (writer == NULL) |
3312 return -1; | 3323 return -1; |
3313 | 3324 |
3314 buf = xmlTextWriterVSprintf(format, argptr); | 3325 buf = xmlTextWriterVSprintf(format, argptr); |
3315 if (buf == 0) | 3326 if (buf == NULL) |
3316 return 0; | 3327 return -1; |
3317 | 3328 |
3318 rc = xmlTextWriterWriteDTDElement(writer, name, buf); | 3329 rc = xmlTextWriterWriteDTDElement(writer, name, buf); |
3319 | 3330 |
3320 xmlFree(buf); | 3331 xmlFree(buf); |
3321 return rc; | 3332 return rc; |
3322 } | 3333 } |
3323 | 3334 |
3324 /** | 3335 /** |
3325 * xmlTextWriterWriteDTDElement: | 3336 * xmlTextWriterWriteDTDElement: |
3326 * @writer: the xmlTextWriterPtr | 3337 * @writer: the xmlTextWriterPtr |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3542 const xmlChar * name, | 3553 const xmlChar * name, |
3543 const char *format, va_list argptr) | 3554 const char *format, va_list argptr) |
3544 { | 3555 { |
3545 int rc; | 3556 int rc; |
3546 xmlChar *buf; | 3557 xmlChar *buf; |
3547 | 3558 |
3548 if (writer == NULL) | 3559 if (writer == NULL) |
3549 return -1; | 3560 return -1; |
3550 | 3561 |
3551 buf = xmlTextWriterVSprintf(format, argptr); | 3562 buf = xmlTextWriterVSprintf(format, argptr); |
3552 if (buf == 0) | 3563 if (buf == NULL) |
3553 return 0; | 3564 return -1; |
3554 | 3565 |
3555 rc = xmlTextWriterWriteDTDAttlist(writer, name, buf); | 3566 rc = xmlTextWriterWriteDTDAttlist(writer, name, buf); |
3556 | 3567 |
3557 xmlFree(buf); | 3568 xmlFree(buf); |
3558 return rc; | 3569 return rc; |
3559 } | 3570 } |
3560 | 3571 |
3561 /** | 3572 /** |
3562 * xmlTextWriterWriteDTDAttlist: | 3573 * xmlTextWriterWriteDTDAttlist: |
3563 * @writer: the xmlTextWriterPtr | 3574 * @writer: the xmlTextWriterPtr |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3804 const char *format, | 3815 const char *format, |
3805 va_list argptr) | 3816 va_list argptr) |
3806 { | 3817 { |
3807 int rc; | 3818 int rc; |
3808 xmlChar *buf; | 3819 xmlChar *buf; |
3809 | 3820 |
3810 if (writer == NULL) | 3821 if (writer == NULL) |
3811 return -1; | 3822 return -1; |
3812 | 3823 |
3813 buf = xmlTextWriterVSprintf(format, argptr); | 3824 buf = xmlTextWriterVSprintf(format, argptr); |
3814 if (buf == 0) | 3825 if (buf == NULL) |
3815 return 0; | 3826 return -1; |
3816 | 3827 |
3817 rc = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, buf); | 3828 rc = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, buf); |
3818 | 3829 |
3819 xmlFree(buf); | 3830 xmlFree(buf); |
3820 return rc; | 3831 return rc; |
3821 } | 3832 } |
3822 | 3833 |
3823 /** | 3834 /** |
3824 * xmlTextWriterWriteDTDEntity: | 3835 * xmlTextWriterWriteDTDEntity: |
3825 * @writer: the xmlTextWriterPtr | 3836 * @writer: the xmlTextWriterPtr |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4693 return -1; | 4704 return -1; |
4694 sum += count; | 4705 sum += count; |
4695 } | 4706 } |
4696 | 4707 |
4697 return sum; | 4708 return sum; |
4698 } | 4709 } |
4699 | 4710 |
4700 #define bottom_xmlwriter | 4711 #define bottom_xmlwriter |
4701 #include "elfgcchack.h" | 4712 #include "elfgcchack.h" |
4702 #endif | 4713 #endif |
OLD | NEW |