Lines Matching refs:writer

3  * xmlwriter.c: XML text writer implementation
100 static int xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer);
112 static int xmlTextWriterWriteIndent(xmlTextWriterPtr writer);
114 xmlTextWriterHandleStateDependencies(xmlTextWriterPtr writer,
119 * @ctxt: a writer context
123 * Handle a writer error
141 * @ctxt: a writer context
146 * Handle a writer error
167 * NOTE: the @out parameter will be deallocated when the writer is closed
305 * NOTE: the @ctxt context will be freed with the resulting writer
470 * @writer: the xmlTextWriterPtr
472 * Deallocate all the resources associated to the writer
475 xmlFreeTextWriter(xmlTextWriterPtr writer)
477 if (writer == NULL)
480 if (writer->out != NULL)
481 xmlOutputBufferClose(writer->out);
483 if (writer->nodes != NULL)
484 xmlListDelete(writer->nodes);
486 if (writer->nsstack != NULL)
487 xmlListDelete(writer->nsstack);
489 if (writer->ctxt != NULL) {
490 if ((writer->ctxt->myDoc != NULL) && (writer->no_doc_free == 0)) {
491 xmlFreeDoc(writer->ctxt->myDoc);
492 writer->ctxt->myDoc = NULL;
494 xmlFreeParserCtxt(writer->ctxt);
497 if (writer->doc != NULL)
498 xmlFreeDoc(writer->doc);
500 if (writer->ichar != NULL)
501 xmlFree(writer->ichar);
502 xmlFree(writer);
507 * @writer: the xmlTextWriterPtr
517 xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version,
525 if ((writer == NULL) || (writer->out == NULL)) {
526 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
527 "xmlTextWriterStartDocument : invalid writer!\n");
531 lk = xmlListFront(writer->nodes);
533 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
542 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
548 writer->out->encoder = encoder;
550 if (writer->out->conv == NULL) {
551 writer->out->conv = xmlBufferCreateSize(4000);
553 xmlCharEncOutFunc(encoder, writer->out->conv, NULL);
554 if ((writer->doc != NULL) && (writer->doc->encoding == NULL))
555 writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name);
557 writer->out->conv = NULL;
560 count = xmlOutputBufferWriteString(writer->out, "<?xml version=");
564 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
569 count = xmlOutputBufferWriteString(writer->out, version);
571 count = xmlOutputBufferWriteString(writer->out, "1.0");
575 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
579 if (writer->out->encoder != 0) {
580 count = xmlOutputBufferWriteString(writer->out, " encoding=");
584 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
589 xmlOutputBufferWriteString(writer->out,
590 writer->out->encoder->name);
594 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
601 count = xmlOutputBufferWriteString(writer->out, " standalone=");
605 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
609 count = xmlOutputBufferWriteString(writer->out, standalone);
613 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
619 count = xmlOutputBufferWriteString(writer->out, "?>\n");
629 * @writer: the xmlTextWriterPtr
637 xmlTextWriterEndDocument(xmlTextWriterPtr writer)
644 if (writer == NULL) {
645 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
646 "xmlTextWriterEndDocument : invalid writer!\n");
651 while ((lk = xmlListFront(writer->nodes)) != NULL) {
659 count = xmlTextWriterEndElement(writer);
666 count = xmlTextWriterEndPI(writer);
672 count = xmlTextWriterEndCDATA(writer);
686 count = xmlTextWriterEndDTD(writer);
692 count = xmlTextWriterEndComment(writer);
702 if (!writer->indent) {
703 count = xmlOutputBufferWriteString(writer->out, "\n");
709 sum += xmlTextWriterFlush(writer);
716 * @writer: the xmlTextWriterPtr
723 xmlTextWriterStartComment(xmlTextWriterPtr writer)
730 if (writer == NULL) {
731 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
732 "xmlTextWriterStartComment : invalid writer!\n");
737 lk = xmlListFront(writer->nodes);
747 count = xmlTextWriterOutputNSDecl(writer);
751 count = xmlOutputBufferWriteString(writer->out, ">");
755 if (writer->indent) {
757 xmlOutputBufferWriteString(writer->out, "\n");
773 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
781 xmlListPushFront(writer->nodes, p);
783 if (writer->indent) {
784 count = xmlTextWriterWriteIndent(writer);
790 count = xmlOutputBufferWriteString(writer->out, "<!--");
800 * @writer: the xmlTextWriterPtr
807 xmlTextWriterEndComment(xmlTextWriterPtr writer)
814 if (writer == NULL) {
815 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
816 "xmlTextWriterEndComment : invalid writer!\n");
820 lk = xmlListFront(writer->nodes);
822 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
834 count = xmlOutputBufferWriteString(writer->out, "-->");
843 if (writer->indent) {
844 count = xmlOutputBufferWriteString(writer->out, "\n");
850 xmlListPopFront(writer->nodes);
856 * @writer: the xmlTextWriterPtr
865 xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
873 rc = xmlTextWriterWriteVFormatComment(writer, format, ap);
881 * @writer: the xmlTextWriterPtr
890 xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
896 if (writer == NULL) {
897 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
898 "xmlTextWriterWriteVFormatComment : invalid writer!\n");
906 rc = xmlTextWriterWriteComment(writer, buf);
914 * @writer: the xmlTextWriterPtr
922 xmlTextWriterWriteComment(xmlTextWriterPtr writer, const xmlChar * content)
928 count = xmlTextWriterStartComment(writer);
932 count = xmlTextWriterWriteString(writer, content);
936 count = xmlTextWriterEndComment(writer);
946 * @writer: the xmlTextWriterPtr
954 xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name)
961 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
965 lk = xmlListFront(writer->nodes);
976 count = xmlTextWriterEndAttribute(writer);
983 count = xmlTextWriterOutputNSDecl(writer);
987 count = xmlOutputBufferWriteString(writer->out, ">");
991 if (writer->indent)
993 xmlOutputBufferWriteString(writer->out, "\n");
1005 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1012 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1019 xmlListPushFront(writer->nodes, p);
1021 if (writer->indent) {
1022 count = xmlTextWriterWriteIndent(writer);
1026 count = xmlOutputBufferWriteString(writer->out, "<");
1031 xmlOutputBufferWriteString(writer->out, (const char *) p->name);
1041 * @writer: the xmlTextWriterPtr
1051 xmlTextWriterStartElementNS(xmlTextWriterPtr writer,
1059 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1070 count = xmlTextWriterStartElement(writer, buf);
1080 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1094 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1099 p->elem = xmlListFront(writer->nodes);
1101 xmlListPushFront(writer->nsstack, p);
1109 * @writer: the xmlTextWriterPtr
1116 xmlTextWriterEndElement(xmlTextWriterPtr writer)
1123 if (writer == NULL)
1126 lk = xmlListFront(writer->nodes);
1128 xmlListDelete(writer->nsstack);
1129 writer->nsstack = NULL;
1135 xmlListDelete(writer->nsstack);
1136 writer->nsstack = NULL;
1143 count = xmlTextWriterEndAttribute(writer);
1145 xmlListDelete(writer->nsstack);
1146 writer->nsstack = NULL;
1153 count = xmlTextWriterOutputNSDecl(writer);
1158 if (writer->indent) /* next element needs indent */
1159 writer->doindent = 1;
1160 count = xmlOutputBufferWriteString(writer->out, "/>");
1166 if ((writer->indent) && (writer->doindent)) {
1167 count = xmlTextWriterWriteIndent(writer);
1169 writer->doindent = 1;
1171 writer->doindent = 1;
1172 count = xmlOutputBufferWriteString(writer->out, "</");
1176 count = xmlOutputBufferWriteString(writer->out,
1181 count = xmlOutputBufferWriteString(writer->out, ">");
1190 if (writer->indent) {
1191 count = xmlOutputBufferWriteString(writer->out, "\n");
1195 xmlListPopFront(writer->nodes);
1201 * @writer: the xmlTextWriterPtr
1208 xmlTextWriterFullEndElement(xmlTextWriterPtr writer)
1215 if (writer == NULL)
1218 lk = xmlListFront(writer->nodes);
1229 count = xmlTextWriterEndAttribute(writer);
1236 count = xmlTextWriterOutputNSDecl(writer);
1241 count = xmlOutputBufferWriteString(writer->out, ">");
1245 if (writer->indent)
1246 writer->doindent = 0;
1249 if ((writer->indent) && (writer->doindent)) {
1250 count = xmlTextWriterWriteIndent(writer);
1252 writer->doindent = 1;
1254 writer->doindent = 1;
1255 count = xmlOutputBufferWriteString(writer->out, "</");
1259 count = xmlOutputBufferWriteString(writer->out,
1264 count = xmlOutputBufferWriteString(writer->out, ">");
1273 if (writer->indent) {
1274 count = xmlOutputBufferWriteString(writer->out, "\n");
1278 xmlListPopFront(writer->nodes);
1284 * @writer: the xmlTextWriterPtr
1293 xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, const char *format,
1301 rc = xmlTextWriterWriteVFormatRaw(writer, format, ap);
1309 * @writer: the xmlTextWriterPtr
1318 xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format,
1324 if (writer == NULL)
1331 rc = xmlTextWriterWriteRaw(writer, buf);
1339 * @writer: the xmlTextWriterPtr
1349 xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content,
1357 if (writer == NULL) {
1358 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
1359 "xmlTextWriterWriteRawLen : invalid writer!\n");
1364 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
1370 lk = xmlListFront(writer->nodes);
1373 count = xmlTextWriterHandleStateDependencies(writer, p);
1379 if (writer->indent)
1380 writer->doindent = 0;
1384 xmlOutputBufferWrite(writer->out, len, (const char *) content);
1395 * @writer: the xmlTextWriterPtr
1403 xmlTextWriterWriteRaw(xmlTextWriterPtr writer, const xmlChar * content)
1405 return xmlTextWriterWriteRawLen(writer, content, xmlStrlen(content));
1410 * @writer: the xmlTextWriterPtr
1419 xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format,
1425 if ((writer == NULL) || (format == NULL))
1430 rc = xmlTextWriterWriteVFormatString(writer, format, ap);
1438 * @writer: the xmlTextWriterPtr
1447 xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer,
1453 if ((writer == NULL) || (format == NULL))
1460 rc = xmlTextWriterWriteString(writer, buf);
1468 * @writer: the xmlTextWriterPtr
1476 xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
1484 if ((writer == NULL) || (content == NULL))
1489 lk = xmlListFront(writer->nodes);
1498 xmlOutputBufferWriteEscape(writer->out, content, NULL);
1504 xmlAttrSerializeTxtContent(writer->out->buffer, writer->doc,
1514 count = xmlTextWriterWriteRaw(writer, buf);
1611 * @writer: the xmlTextWriterPtr
1621 xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data,
1629 if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0))
1633 lk = xmlListFront(writer->nodes);
1637 count = xmlTextWriterHandleStateDependencies(writer, p);
1644 if (writer->indent)
1645 writer->doindent = 0;
1648 xmlOutputBufferWriteBase64(writer->out, len,
1704 * @writer: the xmlTextWriterPtr
1714 xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, const char *data,
1722 if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0))
1726 lk = xmlListFront(writer->nodes);
1730 count = xmlTextWriterHandleStateDependencies(writer, p);
1737 if (writer->indent)
1738 writer->doindent = 0;
1741 xmlOutputBufferWriteBinHex(writer->out, len,
1752 * @writer: the xmlTextWriterPtr
1760 xmlTextWriterStartAttribute(xmlTextWriterPtr writer, const xmlChar * name)
1767 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1771 lk = xmlListFront(writer->nodes);
1781 count = xmlTextWriterEndAttribute(writer);
1787 count = xmlOutputBufferWriteString(writer->out, " ");
1792 xmlOutputBufferWriteString(writer->out,
1797 count = xmlOutputBufferWriteString(writer->out, "=");
1801 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
1816 * @writer: the xmlTextWriterPtr
1826 xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer,
1835 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1850 nsentry.elem = xmlListFront(writer->nodes);
1852 curns = (xmlTextWriterNsStackEntry *)xmlListSearch(writer->nsstack,
1870 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1878 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1883 p->elem = xmlListFront(writer->nodes);
1885 xmlListPushFront(writer->nsstack, p);
1897 count = xmlTextWriterStartAttribute(writer, buf);
1908 * @writer: the xmlTextWriterPtr
1915 xmlTextWriterEndAttribute(xmlTextWriterPtr writer)
1922 if (writer == NULL)
1925 lk = xmlListFront(writer->nodes);
1940 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
1955 * @writer: the xmlTextWriterPtr
1965 xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
1974 rc = xmlTextWriterWriteVFormatAttribute(writer, name, format, ap);
1982 * @writer: the xmlTextWriterPtr
1992 xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
1999 if (writer == NULL)
2006 rc = xmlTextWriterWriteAttribute(writer, name, buf);
2014 * @writer: the xmlTextWriterPtr
2023 xmlTextWriterWriteAttribute(xmlTextWriterPtr writer, const xmlChar * name,
2030 count = xmlTextWriterStartAttribute(writer, name);
2034 count = xmlTextWriterWriteString(writer, content);
2038 count = xmlTextWriterEndAttribute(writer);
2048 * @writer: the xmlTextWriterPtr
2060 xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
2071 rc = xmlTextWriterWriteVFormatAttributeNS(writer, prefix, name,
2080 * @writer: the xmlTextWriterPtr
2092 xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
2101 if (writer == NULL)
2108 rc = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI,
2117 * @writer: the xmlTextWriterPtr
2128 xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer,
2136 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
2140 count = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
2144 count = xmlTextWriterWriteString(writer, content);
2148 count = xmlTextWriterEndAttribute(writer);
2158 * @writer: the xmlTextWriterPtr
2168 xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
2177 rc = xmlTextWriterWriteVFormatElement(writer, name, format, ap);
2185 * @writer: the xmlTextWriterPtr
2195 xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
2202 if (writer == NULL)
2209 rc = xmlTextWriterWriteElement(writer, name, buf);
2217 * @writer: the xmlTextWriterPtr
2226 xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
2233 count = xmlTextWriterStartElement(writer, name);
2237 count = xmlTextWriterWriteString(writer, content);
2241 count = xmlTextWriterEndElement(writer);
2251 * @writer: the xmlTextWriterPtr
2263 xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
2274 rc = xmlTextWriterWriteVFormatElementNS(writer, prefix, name,
2283 * @writer: the xmlTextWriterPtr
2295 xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
2304 if (writer == NULL)
2311 rc = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI,
2320 * @writer: the xmlTextWriterPtr
2331 xmlTextWriterWriteElementNS(xmlTextWriterPtr writer,
2339 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
2344 xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
2348 count = xmlTextWriterWriteString(writer, content);
2352 count = xmlTextWriterEndElement(writer);
2362 * @writer: the xmlTextWriterPtr
2370 xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target)
2377 if ((writer == NULL) || (target == NULL) || (*target == '\0'))
2381 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2387 lk = xmlListFront(writer->nodes);
2393 count = xmlTextWriterEndAttribute(writer);
2400 count = xmlTextWriterOutputNSDecl(writer);
2404 count = xmlOutputBufferWriteString(writer->out, ">");
2416 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2428 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2435 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2442 xmlListPushFront(writer->nodes, p);
2444 count = xmlOutputBufferWriteString(writer->out, "<?");
2449 xmlOutputBufferWriteString(writer->out, (const char *) p->name);
2459 * @writer: the xmlTextWriterPtr
2466 xmlTextWriterEndPI(xmlTextWriterPtr writer)
2473 if (writer == NULL)
2476 lk = xmlListFront(writer->nodes);
2488 count = xmlOutputBufferWriteString(writer->out, "?>");
2497 if (writer->indent) {
2498 count = xmlOutputBufferWriteString(writer->out, "\n");
2504 xmlListPopFront(writer->nodes);
2510 * @writer: the xmlTextWriterPtr
2520 xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target,
2528 rc = xmlTextWriterWriteVFormatPI(writer, target, format, ap);
2536 * @writer: the xmlTextWriterPtr
2546 xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
2553 if (writer == NULL)
2560 rc = xmlTextWriterWritePI(writer, target, buf);
2568 * @writer: the xmlTextWriterPtr
2577 xmlTextWriterWritePI(xmlTextWriterPtr writer, const xmlChar * target,
2584 count = xmlTextWriterStartPI(writer, target);
2589 count = xmlTextWriterWriteString(writer, content);
2594 count = xmlTextWriterEndPI(writer);
2604 * @writer: the xmlTextWriterPtr
2611 xmlTextWriterStartCDATA(xmlTextWriterPtr writer)
2618 if (writer == NULL)
2622 lk = xmlListFront(writer->nodes);
2633 count = xmlTextWriterEndAttribute(writer);
2640 count = xmlTextWriterOutputNSDecl(writer);
2644 count = xmlOutputBufferWriteString(writer->out, ">");
2651 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2663 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2671 xmlListPushFront(writer->nodes, p);
2673 count = xmlOutputBufferWriteString(writer->out, "<![CDATA[");
2683 * @writer: the xmlTextWriterPtr
2690 xmlTextWriterEndCDATA(xmlTextWriterPtr writer)
2697 if (writer == NULL)
2700 lk = xmlListFront(writer->nodes);
2711 count = xmlOutputBufferWriteString(writer->out, "]]>");
2720 xmlListPopFront(writer->nodes);
2726 * @writer: the xmlTextWriterPtr
2735 xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format,
2743 rc = xmlTextWriterWriteVFormatCDATA(writer, format, ap);
2751 * @writer: the xmlTextWriterPtr
2760 xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format,
2766 if (writer == NULL)
2773 rc = xmlTextWriterWriteCDATA(writer, buf);
2781 * @writer: the xmlTextWriterPtr
2789 xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, const xmlChar * content)
2795 count = xmlTextWriterStartCDATA(writer);
2800 count = xmlTextWriterWriteString(writer, content);
2805 count = xmlTextWriterEndCDATA(writer);
2815 * @writer: the xmlTextWriterPtr
2825 xmlTextWriterStartDTD(xmlTextWriterPtr writer,
2834 if (writer == NULL || name == NULL || *name == '\0')
2838 lk = xmlListFront(writer->nodes);
2840 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2848 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2855 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2862 xmlListPushFront(writer->nodes, p);
2864 count = xmlOutputBufferWriteString(writer->out, "<!DOCTYPE ");
2868 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
2875 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2880 if (writer->indent)
2881 count = xmlOutputBufferWrite(writer->out, 1, "\n");
2883 count = xmlOutputBufferWrite(writer->out, 1, " ");
2888 count = xmlOutputBufferWriteString(writer->out, "PUBLIC ");
2893 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2899 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
2904 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2912 if (writer->indent)
2913 count = xmlOutputBufferWrite(writer->out, 1, "\n");
2915 count = xmlOutputBufferWrite(writer->out, 1, " ");
2919 count = xmlOutputBufferWriteString(writer->out, "SYSTEM ");
2924 if (writer->indent)
2925 count = xmlOutputBufferWriteString(writer->out, "\n ");
2927 count = xmlOutputBufferWrite(writer->out, 1, " ");
2933 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2939 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
2944 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2955 * @writer: the xmlTextWriterPtr
2962 xmlTextWriterEndDTD(xmlTextWriterPtr writer)
2970 if (writer == NULL)
2976 lk = xmlListFront(writer->nodes);
2984 count = xmlOutputBufferWriteString(writer->out, "]");
2990 count = xmlOutputBufferWriteString(writer->out, ">");
2992 if (writer->indent) {
2996 count = xmlOutputBufferWriteString(writer->out, "\n");
2999 xmlListPopFront(writer->nodes);
3003 count = xmlTextWriterEndDTDElement(writer);
3007 count = xmlTextWriterEndDTDAttlist(writer);
3012 count = xmlTextWriterEndDTDEntity(writer);
3015 count = xmlTextWriterEndComment(writer);
3032 * @writer: the xmlTextWriterPtr
3044 xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
3054 rc = xmlTextWriterWriteVFormatDTD(writer, name, pubid, sysid, format,
3063 * @writer: the xmlTextWriterPtr
3075 xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
3084 if (writer == NULL)
3091 rc = xmlTextWriterWriteDTD(writer, name, pubid, sysid, buf);
3099 * @writer: the xmlTextWriterPtr
3110 xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
3119 count = xmlTextWriterStartDTD(writer, name, pubid, sysid);
3124 count = xmlTextWriterWriteString(writer, subset);
3129 count = xmlTextWriterEndDTD(writer);
3139 * @writer: the xmlTextWriterPtr
3147 xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, const xmlChar * name)
3154 if (writer == NULL || name == NULL || *name == '\0')
3158 lk = xmlListFront(writer->nodes);
3167 count = xmlOutputBufferWriteString(writer->out, " [");
3171 if (writer->indent) {
3172 count = xmlOutputBufferWriteString(writer->out, "\n");
3190 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3197 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3204 xmlListPushFront(writer->nodes, p);
3206 if (writer->indent) {
3207 count = xmlTextWriterWriteIndent(writer);
3213 count = xmlOutputBufferWriteString(writer->out, "<!ELEMENT ");
3217 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3227 * @writer: the xmlTextWriterPtr
3234 xmlTextWriterEndDTDElement(xmlTextWriterPtr writer)
3241 if (writer == NULL)
3245 lk = xmlListFront(writer->nodes);
3256 count = xmlOutputBufferWriteString(writer->out, ">");
3265 if (writer->indent) {
3266 count = xmlOutputBufferWriteString(writer->out, "\n");
3272 xmlListPopFront(writer->nodes);
3278 * @writer: the xmlTextWriterPtr
3288 xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
3297 rc = xmlTextWriterWriteVFormatDTDElement(writer, name, format, ap);
3305 * @writer: the xmlTextWriterPtr
3315 xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
3322 if (writer == NULL)
3329 rc = xmlTextWriterWriteDTDElement(writer, name, buf);
3337 * @writer: the xmlTextWriterPtr
3346 xmlTextWriterWriteDTDElement(xmlTextWriterPtr writer,
3356 count = xmlTextWriterStartDTDElement(writer, name);
3361 count = xmlTextWriterWriteString(writer, content);
3366 count = xmlTextWriterEndDTDElement(writer);
3376 * @writer: the xmlTextWriterPtr
3384 xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name)
3391 if (writer == NULL || name == NULL || *name == '\0')
3395 lk = xmlListFront(writer->nodes);
3404 count = xmlOutputBufferWriteString(writer->out, " [");
3408 if (writer->indent) {
3409 count = xmlOutputBufferWriteString(writer->out, "\n");
3427 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3434 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3441 xmlListPushFront(writer->nodes, p);
3443 if (writer->indent) {
3444 count = xmlTextWriterWriteIndent(writer);
3450 count = xmlOutputBufferWriteString(writer->out, "<!ATTLIST ");
3454 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3464 * @writer: the xmlTextWriterPtr
3471 xmlTextWriterEndDTDAttlist(xmlTextWriterPtr writer)
3478 if (writer == NULL)
3482 lk = xmlListFront(writer->nodes);
3493 count = xmlOutputBufferWriteString(writer->out, ">");
3502 if (writer->indent) {
3503 count = xmlOutputBufferWriteString(writer->out, "\n");
3509 xmlListPopFront(writer->nodes);
3515 * @writer: the xmlTextWriterPtr
3525 xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
3534 rc = xmlTextWriterWriteVFormatDTDAttlist(writer, name, format, ap);
3542 * @writer: the xmlTextWriterPtr
3552 xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
3559 if (writer == NULL)
3566 rc = xmlTextWriterWriteDTDAttlist(writer, name, buf);
3574 * @writer: the xmlTextWriterPtr
3583 xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr writer,
3593 count = xmlTextWriterStartDTDAttlist(writer, name);
3598 count = xmlTextWriterWriteString(writer, content);
3603 count = xmlTextWriterEndDTDAttlist(writer);
3613 * @writer: the xmlTextWriterPtr
3622 xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
3630 if (writer == NULL || name == NULL || *name == '\0')
3634 lk = xmlListFront(writer->nodes);
3641 count = xmlOutputBufferWriteString(writer->out, " [");
3645 if (writer->indent) {
3647 xmlOutputBufferWriteString(writer->out, "\n");
3666 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3673 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3684 xmlListPushFront(writer->nodes, p);
3686 if (writer->indent) {
3687 count = xmlTextWriterWriteIndent(writer);
3693 count = xmlOutputBufferWriteString(writer->out, "<!ENTITY ");
3699 count = xmlOutputBufferWriteString(writer->out, "% ");
3705 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3715 * @writer: the xmlTextWriterPtr
3722 xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
3729 if (writer == NULL)
3733 lk = xmlListFront(writer->nodes);
3743 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
3749 count = xmlOutputBufferWriteString(writer->out, ">");
3758 if (writer->indent) {
3759 count = xmlOutputBufferWriteString(writer->out, "\n");
3765 xmlListPopFront(writer->nodes);
3771 * @writer: the xmlTextWriterPtr
3782 xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
3792 rc = xmlTextWriterWriteVFormatDTDInternalEntity(writer, pe, name,
3801 * @writer: the xmlTextWriterPtr
3812 xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
3821 if (writer == NULL)
3828 rc = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, buf);
3836 * @writer: the xmlTextWriterPtr
3849 xmlTextWriterWriteDTDEntity(xmlTextWriterPtr writer,
3863 return xmlTextWriterWriteDTDInternalEntity(writer, pe, name,
3866 return xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid,
3872 * @writer: the xmlTextWriterPtr
3882 xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
3894 count = xmlTextWriterStartDTDEntity(writer, pe, name);
3899 count = xmlTextWriterWriteString(writer, content);
3904 count = xmlTextWriterEndDTDEntity(writer);
3914 * @writer: the xmlTextWriterPtr
3926 xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
3942 count = xmlTextWriterStartDTDEntity(writer, pe, name);
3948 xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid,
3954 count = xmlTextWriterEndDTDEntity(writer);
3964 * @writer: the xmlTextWriterPtr
3974 xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer,
3984 if (writer == NULL) {
3985 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
3991 lk = xmlListFront(writer->nodes);
3993 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4007 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4013 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4020 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4025 count = xmlOutputBufferWriteString(writer->out, " PUBLIC ");
4030 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4036 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
4041 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4049 count = xmlOutputBufferWriteString(writer->out, " SYSTEM");
4055 count = xmlOutputBufferWriteString(writer->out, " ");
4060 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4066 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
4071 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4078 count = xmlOutputBufferWriteString(writer->out, " NDATA ");
4084 xmlOutputBufferWriteString(writer->out,
4096 * @writer: the xmlTextWriterPtr
4106 xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
4115 if (writer == NULL || name == NULL || *name == '\0')
4119 lk = xmlListFront(writer->nodes);
4128 count = xmlOutputBufferWriteString(writer->out, " [");
4132 if (writer->indent) {
4133 count = xmlOutputBufferWriteString(writer->out, "\n");
4147 if (writer->indent) {
4148 count = xmlTextWriterWriteIndent(writer);
4154 count = xmlOutputBufferWriteString(writer->out, "<!NOTATION ");
4158 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
4164 count = xmlOutputBufferWriteString(writer->out, " PUBLIC ");
4168 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4173 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
4177 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4185 count = xmlOutputBufferWriteString(writer->out, " SYSTEM");
4190 count = xmlOutputBufferWriteString(writer->out, " ");
4194 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4199 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
4203 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4209 count = xmlOutputBufferWriteString(writer->out, ">");
4219 * @writer: the xmlTextWriterPtr
4226 xmlTextWriterFlush(xmlTextWriterPtr writer)
4230 if (writer == NULL)
4233 if (writer->out == NULL)
4236 count = xmlOutputBufferFlush(writer->out);
4301 * @writer: the xmlTextWriterPtr
4306 xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer)
4314 while (!xmlListEmpty(writer->nsstack)) {
4318 lk = xmlListFront(writer->nsstack);
4326 xmlListPopFront(writer->nsstack);
4329 count = xmlTextWriterWriteAttribute(writer, prefix, namespaceURI);
4334 xmlListDelete(writer->nsstack);
4335 writer->nsstack = NULL;
4564 * @writer: the xmlTextWriterPtr
4572 xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent)
4574 if ((writer == NULL) || (indent < 0))
4577 writer->indent = indent;
4578 writer->doindent = 1;
4585 * @writer: the xmlTextWriterPtr
4593 xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str)
4595 if ((writer == NULL) || (!str))
4598 if (writer->ichar != NULL)
4599 xmlFree(writer->ichar);
4600 writer->ichar = xmlStrdup(str);
4602 if (!writer->ichar)
4610 * @writer: the xmlTextWriterPtr
4617 xmlTextWriterWriteIndent(xmlTextWriterPtr writer)
4623 lksize = xmlListSize(writer->nodes);
4627 ret = xmlOutputBufferWriteString(writer->out,
4628 (const char *) writer->ichar);
4638 * @writer: the xmlTextWriterPtr
4646 xmlTextWriterHandleStateDependencies(xmlTextWriterPtr writer,
4653 if (writer == NULL)
4666 count = xmlTextWriterOutputNSDecl(writer);
4693 extra[1] = writer->qchar;
4702 count = xmlOutputBufferWriteString(writer->out, extra);