Lines Matching refs:writer

3  * xmlwriter.c: XML text writer implementation
108 static int xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer);
120 static int xmlTextWriterWriteIndent(xmlTextWriterPtr writer);
122 xmlTextWriterHandleStateDependencies(xmlTextWriterPtr writer,
127 * @ctxt: a writer context
131 * Handle a writer error
149 * @ctxt: a writer context
154 * Handle a writer error
175 * NOTE: the @out parameter will be deallocated when the writer is closed
313 * NOTE: the @ctxt context will be freed with the resulting writer
478 * @writer: the xmlTextWriterPtr
480 * Deallocate all the resources associated to the writer
483 xmlFreeTextWriter(xmlTextWriterPtr writer)
485 if (writer == NULL)
488 if (writer->out != NULL)
489 xmlOutputBufferClose(writer->out);
491 if (writer->nodes != NULL)
492 xmlListDelete(writer->nodes);
494 if (writer->nsstack != NULL)
495 xmlListDelete(writer->nsstack);
497 if (writer->ctxt != NULL) {
498 if ((writer->ctxt->myDoc != NULL) && (writer->no_doc_free == 0)) {
499 xmlFreeDoc(writer->ctxt->myDoc);
500 writer->ctxt->myDoc = NULL;
502 xmlFreeParserCtxt(writer->ctxt);
505 if (writer->doc != NULL)
506 xmlFreeDoc(writer->doc);
508 if (writer->ichar != NULL)
509 xmlFree(writer->ichar);
510 xmlFree(writer);
515 * @writer: the xmlTextWriterPtr
525 xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version,
533 if ((writer == NULL) || (writer->out == NULL)) {
534 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
535 "xmlTextWriterStartDocument : invalid writer!\n");
539 lk = xmlListFront(writer->nodes);
541 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
550 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
556 writer->out->encoder = encoder;
558 if (writer->out->conv == NULL) {
559 writer->out->conv = xmlBufCreateSize(4000);
561 xmlCharEncOutput(writer->out, 1);
562 if ((writer->doc != NULL) && (writer->doc->encoding == NULL))
563 writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name);
565 writer->out->conv = NULL;
568 count = xmlOutputBufferWriteString(writer->out, "<?xml version=");
572 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
577 count = xmlOutputBufferWriteString(writer->out, version);
579 count = xmlOutputBufferWriteString(writer->out, "1.0");
583 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
587 if (writer->out->encoder != 0) {
588 count = xmlOutputBufferWriteString(writer->out, " encoding=");
592 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
597 xmlOutputBufferWriteString(writer->out,
598 writer->out->encoder->name);
602 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
609 count = xmlOutputBufferWriteString(writer->out, " standalone=");
613 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
617 count = xmlOutputBufferWriteString(writer->out, standalone);
621 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
627 count = xmlOutputBufferWriteString(writer->out, "?>\n");
637 * @writer: the xmlTextWriterPtr
645 xmlTextWriterEndDocument(xmlTextWriterPtr writer)
652 if (writer == NULL) {
653 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
654 "xmlTextWriterEndDocument : invalid writer!\n");
659 while ((lk = xmlListFront(writer->nodes)) != NULL) {
667 count = xmlTextWriterEndElement(writer);
674 count = xmlTextWriterEndPI(writer);
680 count = xmlTextWriterEndCDATA(writer);
694 count = xmlTextWriterEndDTD(writer);
700 count = xmlTextWriterEndComment(writer);
710 if (!writer->indent) {
711 count = xmlOutputBufferWriteString(writer->out, "\n");
717 sum += xmlTextWriterFlush(writer);
724 * @writer: the xmlTextWriterPtr
731 xmlTextWriterStartComment(xmlTextWriterPtr writer)
738 if (writer == NULL) {
739 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
740 "xmlTextWriterStartComment : invalid writer!\n");
745 lk = xmlListFront(writer->nodes);
755 count = xmlTextWriterOutputNSDecl(writer);
759 count = xmlOutputBufferWriteString(writer->out, ">");
763 if (writer->indent) {
765 xmlOutputBufferWriteString(writer->out, "\n");
781 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
789 xmlListPushFront(writer->nodes, p);
791 if (writer->indent) {
792 count = xmlTextWriterWriteIndent(writer);
798 count = xmlOutputBufferWriteString(writer->out, "<!--");
808 * @writer: the xmlTextWriterPtr
815 xmlTextWriterEndComment(xmlTextWriterPtr writer)
822 if (writer == NULL) {
823 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
824 "xmlTextWriterEndComment : invalid writer!\n");
828 lk = xmlListFront(writer->nodes);
830 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
842 count = xmlOutputBufferWriteString(writer->out, "-->");
851 if (writer->indent) {
852 count = xmlOutputBufferWriteString(writer->out, "\n");
858 xmlListPopFront(writer->nodes);
864 * @writer: the xmlTextWriterPtr
873 xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
881 rc = xmlTextWriterWriteVFormatComment(writer, format, ap);
889 * @writer: the xmlTextWriterPtr
898 xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
904 if (writer == NULL) {
905 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
906 "xmlTextWriterWriteVFormatComment : invalid writer!\n");
914 rc = xmlTextWriterWriteComment(writer, buf);
922 * @writer: the xmlTextWriterPtr
930 xmlTextWriterWriteComment(xmlTextWriterPtr writer, const xmlChar * content)
936 count = xmlTextWriterStartComment(writer);
940 count = xmlTextWriterWriteString(writer, content);
944 count = xmlTextWriterEndComment(writer);
954 * @writer: the xmlTextWriterPtr
962 xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name)
969 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
973 lk = xmlListFront(writer->nodes);
984 count = xmlTextWriterEndAttribute(writer);
991 count = xmlTextWriterOutputNSDecl(writer);
995 count = xmlOutputBufferWriteString(writer->out, ">");
999 if (writer->indent)
1001 xmlOutputBufferWriteString(writer->out, "\n");
1013 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1020 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1027 xmlListPushFront(writer->nodes, p);
1029 if (writer->indent) {
1030 count = xmlTextWriterWriteIndent(writer);
1034 count = xmlOutputBufferWriteString(writer->out, "<");
1039 xmlOutputBufferWriteString(writer->out, (const char *) p->name);
1049 * @writer: the xmlTextWriterPtr
1059 xmlTextWriterStartElementNS(xmlTextWriterPtr writer,
1067 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1078 count = xmlTextWriterStartElement(writer, buf);
1088 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1102 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1107 p->elem = xmlListFront(writer->nodes);
1109 xmlListPushFront(writer->nsstack, p);
1117 * @writer: the xmlTextWriterPtr
1124 xmlTextWriterEndElement(xmlTextWriterPtr writer)
1131 if (writer == NULL)
1134 lk = xmlListFront(writer->nodes);
1136 xmlListDelete(writer->nsstack);
1137 writer->nsstack = NULL;
1143 xmlListDelete(writer->nsstack);
1144 writer->nsstack = NULL;
1151 count = xmlTextWriterEndAttribute(writer);
1153 xmlListDelete(writer->nsstack);
1154 writer->nsstack = NULL;
1161 count = xmlTextWriterOutputNSDecl(writer);
1166 if (writer->indent) /* next element needs indent */
1167 writer->doindent = 1;
1168 count = xmlOutputBufferWriteString(writer->out, "/>");
1174 if ((writer->indent) && (writer->doindent)) {
1175 count = xmlTextWriterWriteIndent(writer);
1177 writer->doindent = 1;
1179 writer->doindent = 1;
1180 count = xmlOutputBufferWriteString(writer->out, "</");
1184 count = xmlOutputBufferWriteString(writer->out,
1189 count = xmlOutputBufferWriteString(writer->out, ">");
1198 if (writer->indent) {
1199 count = xmlOutputBufferWriteString(writer->out, "\n");
1203 xmlListPopFront(writer->nodes);
1209 * @writer: the xmlTextWriterPtr
1216 xmlTextWriterFullEndElement(xmlTextWriterPtr writer)
1223 if (writer == NULL)
1226 lk = xmlListFront(writer->nodes);
1237 count = xmlTextWriterEndAttribute(writer);
1244 count = xmlTextWriterOutputNSDecl(writer);
1249 count = xmlOutputBufferWriteString(writer->out, ">");
1253 if (writer->indent)
1254 writer->doindent = 0;
1257 if ((writer->indent) && (writer->doindent)) {
1258 count = xmlTextWriterWriteIndent(writer);
1260 writer->doindent = 1;
1262 writer->doindent = 1;
1263 count = xmlOutputBufferWriteString(writer->out, "</");
1267 count = xmlOutputBufferWriteString(writer->out,
1272 count = xmlOutputBufferWriteString(writer->out, ">");
1281 if (writer->indent) {
1282 count = xmlOutputBufferWriteString(writer->out, "\n");
1286 xmlListPopFront(writer->nodes);
1292 * @writer: the xmlTextWriterPtr
1301 xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, const char *format,
1309 rc = xmlTextWriterWriteVFormatRaw(writer, format, ap);
1317 * @writer: the xmlTextWriterPtr
1326 xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format,
1332 if (writer == NULL)
1339 rc = xmlTextWriterWriteRaw(writer, buf);
1347 * @writer: the xmlTextWriterPtr
1357 xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content,
1365 if (writer == NULL) {
1366 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
1367 "xmlTextWriterWriteRawLen : invalid writer!\n");
1372 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
1378 lk = xmlListFront(writer->nodes);
1381 count = xmlTextWriterHandleStateDependencies(writer, p);
1387 if (writer->indent)
1388 writer->doindent = 0;
1392 xmlOutputBufferWrite(writer->out, len, (const char *) content);
1403 * @writer: the xmlTextWriterPtr
1411 xmlTextWriterWriteRaw(xmlTextWriterPtr writer, const xmlChar * content)
1413 return xmlTextWriterWriteRawLen(writer, content, xmlStrlen(content));
1418 * @writer: the xmlTextWriterPtr
1427 xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format,
1433 if ((writer == NULL) || (format == NULL))
1438 rc = xmlTextWriterWriteVFormatString(writer, format, ap);
1446 * @writer: the xmlTextWriterPtr
1455 xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer,
1461 if ((writer == NULL) || (format == NULL))
1468 rc = xmlTextWriterWriteString(writer, buf);
1476 * @writer: the xmlTextWriterPtr
1484 xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
1492 if ((writer == NULL) || (content == NULL))
1497 lk = xmlListFront(writer->nodes);
1506 xmlOutputBufferWriteEscape(writer->out, content, NULL);
1512 xmlBufAttrSerializeTxtContent(writer->out->buffer,
1513 writer->doc, NULL, content);
1522 count = xmlTextWriterWriteRaw(writer, buf);
1619 * @writer: the xmlTextWriterPtr
1629 xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data,
1637 if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0))
1641 lk = xmlListFront(writer->nodes);
1645 count = xmlTextWriterHandleStateDependencies(writer, p);
1652 if (writer->indent)
1653 writer->doindent = 0;
1656 xmlOutputBufferWriteBase64(writer->out, len,
1712 * @writer: the xmlTextWriterPtr
1722 xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, const char *data,
1730 if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0))
1734 lk = xmlListFront(writer->nodes);
1738 count = xmlTextWriterHandleStateDependencies(writer, p);
1745 if (writer->indent)
1746 writer->doindent = 0;
1749 xmlOutputBufferWriteBinHex(writer->out, len,
1760 * @writer: the xmlTextWriterPtr
1768 xmlTextWriterStartAttribute(xmlTextWriterPtr writer, const xmlChar * name)
1775 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1779 lk = xmlListFront(writer->nodes);
1789 count = xmlTextWriterEndAttribute(writer);
1795 count = xmlOutputBufferWriteString(writer->out, " ");
1800 xmlOutputBufferWriteString(writer->out,
1805 count = xmlOutputBufferWriteString(writer->out, "=");
1809 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
1824 * @writer: the xmlTextWriterPtr
1834 xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer,
1843 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1858 nsentry.elem = xmlListFront(writer->nodes);
1860 curns = (xmlTextWriterNsStackEntry *)xmlListSearch(writer->nsstack,
1878 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1886 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1891 p->elem = xmlListFront(writer->nodes);
1893 xmlListPushFront(writer->nsstack, p);
1905 count = xmlTextWriterStartAttribute(writer, buf);
1916 * @writer: the xmlTextWriterPtr
1923 xmlTextWriterEndAttribute(xmlTextWriterPtr writer)
1930 if (writer == NULL)
1933 lk = xmlListFront(writer->nodes);
1948 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
1963 * @writer: the xmlTextWriterPtr
1973 xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
1982 rc = xmlTextWriterWriteVFormatAttribute(writer, name, format, ap);
1990 * @writer: the xmlTextWriterPtr
2000 xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
2007 if (writer == NULL)
2014 rc = xmlTextWriterWriteAttribute(writer, name, buf);
2022 * @writer: the xmlTextWriterPtr
2031 xmlTextWriterWriteAttribute(xmlTextWriterPtr writer, const xmlChar * name,
2038 count = xmlTextWriterStartAttribute(writer, name);
2042 count = xmlTextWriterWriteString(writer, content);
2046 count = xmlTextWriterEndAttribute(writer);
2056 * @writer: the xmlTextWriterPtr
2068 xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
2079 rc = xmlTextWriterWriteVFormatAttributeNS(writer, prefix, name,
2088 * @writer: the xmlTextWriterPtr
2100 xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
2109 if (writer == NULL)
2116 rc = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI,
2125 * @writer: the xmlTextWriterPtr
2136 xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer,
2144 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
2148 count = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
2152 count = xmlTextWriterWriteString(writer, content);
2156 count = xmlTextWriterEndAttribute(writer);
2166 * @writer: the xmlTextWriterPtr
2176 xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
2185 rc = xmlTextWriterWriteVFormatElement(writer, name, format, ap);
2193 * @writer: the xmlTextWriterPtr
2203 xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
2210 if (writer == NULL)
2217 rc = xmlTextWriterWriteElement(writer, name, buf);
2225 * @writer: the xmlTextWriterPtr
2234 xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
2241 count = xmlTextWriterStartElement(writer, name);
2246 count = xmlTextWriterWriteString(writer, content);
2251 count = xmlTextWriterEndElement(writer);
2261 * @writer: the xmlTextWriterPtr
2273 xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
2284 rc = xmlTextWriterWriteVFormatElementNS(writer, prefix, name,
2293 * @writer: the xmlTextWriterPtr
2305 xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
2314 if (writer == NULL)
2321 rc = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI,
2330 * @writer: the xmlTextWriterPtr
2341 xmlTextWriterWriteElementNS(xmlTextWriterPtr writer,
2349 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
2354 xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
2358 count = xmlTextWriterWriteString(writer, content);
2362 count = xmlTextWriterEndElement(writer);
2372 * @writer: the xmlTextWriterPtr
2380 xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target)
2387 if ((writer == NULL) || (target == NULL) || (*target == '\0'))
2391 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2397 lk = xmlListFront(writer->nodes);
2403 count = xmlTextWriterEndAttribute(writer);
2410 count = xmlTextWriterOutputNSDecl(writer);
2414 count = xmlOutputBufferWriteString(writer->out, ">");
2426 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2438 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2445 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2452 xmlListPushFront(writer->nodes, p);
2454 count = xmlOutputBufferWriteString(writer->out, "<?");
2459 xmlOutputBufferWriteString(writer->out, (const char *) p->name);
2469 * @writer: the xmlTextWriterPtr
2476 xmlTextWriterEndPI(xmlTextWriterPtr writer)
2483 if (writer == NULL)
2486 lk = xmlListFront(writer->nodes);
2498 count = xmlOutputBufferWriteString(writer->out, "?>");
2507 if (writer->indent) {
2508 count = xmlOutputBufferWriteString(writer->out, "\n");
2514 xmlListPopFront(writer->nodes);
2520 * @writer: the xmlTextWriterPtr
2530 xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target,
2538 rc = xmlTextWriterWriteVFormatPI(writer, target, format, ap);
2546 * @writer: the xmlTextWriterPtr
2556 xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
2563 if (writer == NULL)
2570 rc = xmlTextWriterWritePI(writer, target, buf);
2578 * @writer: the xmlTextWriterPtr
2587 xmlTextWriterWritePI(xmlTextWriterPtr writer, const xmlChar * target,
2594 count = xmlTextWriterStartPI(writer, target);
2599 count = xmlTextWriterWriteString(writer, content);
2604 count = xmlTextWriterEndPI(writer);
2614 * @writer: the xmlTextWriterPtr
2621 xmlTextWriterStartCDATA(xmlTextWriterPtr writer)
2628 if (writer == NULL)
2632 lk = xmlListFront(writer->nodes);
2643 count = xmlTextWriterEndAttribute(writer);
2650 count = xmlTextWriterOutputNSDecl(writer);
2654 count = xmlOutputBufferWriteString(writer->out, ">");
2661 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2673 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2681 xmlListPushFront(writer->nodes, p);
2683 count = xmlOutputBufferWriteString(writer->out, "<![CDATA[");
2693 * @writer: the xmlTextWriterPtr
2700 xmlTextWriterEndCDATA(xmlTextWriterPtr writer)
2707 if (writer == NULL)
2710 lk = xmlListFront(writer->nodes);
2721 count = xmlOutputBufferWriteString(writer->out, "]]>");
2730 xmlListPopFront(writer->nodes);
2736 * @writer: the xmlTextWriterPtr
2745 xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format,
2753 rc = xmlTextWriterWriteVFormatCDATA(writer, format, ap);
2761 * @writer: the xmlTextWriterPtr
2770 xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format,
2776 if (writer == NULL)
2783 rc = xmlTextWriterWriteCDATA(writer, buf);
2791 * @writer: the xmlTextWriterPtr
2799 xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, const xmlChar * content)
2805 count = xmlTextWriterStartCDATA(writer);
2810 count = xmlTextWriterWriteString(writer, content);
2815 count = xmlTextWriterEndCDATA(writer);
2825 * @writer: the xmlTextWriterPtr
2835 xmlTextWriterStartDTD(xmlTextWriterPtr writer,
2844 if (writer == NULL || name == NULL || *name == '\0')
2848 lk = xmlListFront(writer->nodes);
2850 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2858 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2865 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2872 xmlListPushFront(writer->nodes, p);
2874 count = xmlOutputBufferWriteString(writer->out, "<!DOCTYPE ");
2878 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
2885 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2890 if (writer->indent)
2891 count = xmlOutputBufferWrite(writer->out, 1, "\n");
2893 count = xmlOutputBufferWrite(writer->out, 1, " ");
2898 count = xmlOutputBufferWriteString(writer->out, "PUBLIC ");
2903 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2909 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
2914 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2922 if (writer->indent)
2923 count = xmlOutputBufferWrite(writer->out, 1, "\n");
2925 count = xmlOutputBufferWrite(writer->out, 1, " ");
2929 count = xmlOutputBufferWriteString(writer->out, "SYSTEM ");
2934 if (writer->indent)
2935 count = xmlOutputBufferWriteString(writer->out, "\n ");
2937 count = xmlOutputBufferWrite(writer->out, 1, " ");
2943 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2949 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
2954 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2965 * @writer: the xmlTextWriterPtr
2972 xmlTextWriterEndDTD(xmlTextWriterPtr writer)
2980 if (writer == NULL)
2986 lk = xmlListFront(writer->nodes);
2994 count = xmlOutputBufferWriteString(writer->out, "]");
3000 count = xmlOutputBufferWriteString(writer->out, ">");
3002 if (writer->indent) {
3006 count = xmlOutputBufferWriteString(writer->out, "\n");
3009 xmlListPopFront(writer->nodes);
3013 count = xmlTextWriterEndDTDElement(writer);
3017 count = xmlTextWriterEndDTDAttlist(writer);
3022 count = xmlTextWriterEndDTDEntity(writer);
3025 count = xmlTextWriterEndComment(writer);
3042 * @writer: the xmlTextWriterPtr
3054 xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
3064 rc = xmlTextWriterWriteVFormatDTD(writer, name, pubid, sysid, format,
3073 * @writer: the xmlTextWriterPtr
3085 xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
3094 if (writer == NULL)
3101 rc = xmlTextWriterWriteDTD(writer, name, pubid, sysid, buf);
3109 * @writer: the xmlTextWriterPtr
3120 xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
3129 count = xmlTextWriterStartDTD(writer, name, pubid, sysid);
3134 count = xmlTextWriterWriteString(writer, subset);
3139 count = xmlTextWriterEndDTD(writer);
3149 * @writer: the xmlTextWriterPtr
3157 xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, const xmlChar * name)
3164 if (writer == NULL || name == NULL || *name == '\0')
3168 lk = xmlListFront(writer->nodes);
3177 count = xmlOutputBufferWriteString(writer->out, " [");
3181 if (writer->indent) {
3182 count = xmlOutputBufferWriteString(writer->out, "\n");
3200 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3207 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3214 xmlListPushFront(writer->nodes, p);
3216 if (writer->indent) {
3217 count = xmlTextWriterWriteIndent(writer);
3223 count = xmlOutputBufferWriteString(writer->out, "<!ELEMENT ");
3227 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3237 * @writer: the xmlTextWriterPtr
3244 xmlTextWriterEndDTDElement(xmlTextWriterPtr writer)
3251 if (writer == NULL)
3255 lk = xmlListFront(writer->nodes);
3266 count = xmlOutputBufferWriteString(writer->out, ">");
3275 if (writer->indent) {
3276 count = xmlOutputBufferWriteString(writer->out, "\n");
3282 xmlListPopFront(writer->nodes);
3288 * @writer: the xmlTextWriterPtr
3298 xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
3307 rc = xmlTextWriterWriteVFormatDTDElement(writer, name, format, ap);
3315 * @writer: the xmlTextWriterPtr
3325 xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
3332 if (writer == NULL)
3339 rc = xmlTextWriterWriteDTDElement(writer, name, buf);
3347 * @writer: the xmlTextWriterPtr
3356 xmlTextWriterWriteDTDElement(xmlTextWriterPtr writer,
3366 count = xmlTextWriterStartDTDElement(writer, name);
3371 count = xmlTextWriterWriteString(writer, content);
3376 count = xmlTextWriterEndDTDElement(writer);
3386 * @writer: the xmlTextWriterPtr
3394 xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name)
3401 if (writer == NULL || name == NULL || *name == '\0')
3405 lk = xmlListFront(writer->nodes);
3414 count = xmlOutputBufferWriteString(writer->out, " [");
3418 if (writer->indent) {
3419 count = xmlOutputBufferWriteString(writer->out, "\n");
3437 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3444 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3451 xmlListPushFront(writer->nodes, p);
3453 if (writer->indent) {
3454 count = xmlTextWriterWriteIndent(writer);
3460 count = xmlOutputBufferWriteString(writer->out, "<!ATTLIST ");
3464 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3474 * @writer: the xmlTextWriterPtr
3481 xmlTextWriterEndDTDAttlist(xmlTextWriterPtr writer)
3488 if (writer == NULL)
3492 lk = xmlListFront(writer->nodes);
3503 count = xmlOutputBufferWriteString(writer->out, ">");
3512 if (writer->indent) {
3513 count = xmlOutputBufferWriteString(writer->out, "\n");
3519 xmlListPopFront(writer->nodes);
3525 * @writer: the xmlTextWriterPtr
3535 xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
3544 rc = xmlTextWriterWriteVFormatDTDAttlist(writer, name, format, ap);
3552 * @writer: the xmlTextWriterPtr
3562 xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
3569 if (writer == NULL)
3576 rc = xmlTextWriterWriteDTDAttlist(writer, name, buf);
3584 * @writer: the xmlTextWriterPtr
3593 xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr writer,
3603 count = xmlTextWriterStartDTDAttlist(writer, name);
3608 count = xmlTextWriterWriteString(writer, content);
3613 count = xmlTextWriterEndDTDAttlist(writer);
3623 * @writer: the xmlTextWriterPtr
3632 xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
3640 if (writer == NULL || name == NULL || *name == '\0')
3644 lk = xmlListFront(writer->nodes);
3651 count = xmlOutputBufferWriteString(writer->out, " [");
3655 if (writer->indent) {
3657 xmlOutputBufferWriteString(writer->out, "\n");
3676 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3683 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3694 xmlListPushFront(writer->nodes, p);
3696 if (writer->indent) {
3697 count = xmlTextWriterWriteIndent(writer);
3703 count = xmlOutputBufferWriteString(writer->out, "<!ENTITY ");
3709 count = xmlOutputBufferWriteString(writer->out, "% ");
3715 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3725 * @writer: the xmlTextWriterPtr
3732 xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
3739 if (writer == NULL)
3743 lk = xmlListFront(writer->nodes);
3753 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
3759 count = xmlOutputBufferWriteString(writer->out, ">");
3768 if (writer->indent) {
3769 count = xmlOutputBufferWriteString(writer->out, "\n");
3775 xmlListPopFront(writer->nodes);
3781 * @writer: the xmlTextWriterPtr
3792 xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
3802 rc = xmlTextWriterWriteVFormatDTDInternalEntity(writer, pe, name,
3811 * @writer: the xmlTextWriterPtr
3822 xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
3831 if (writer == NULL)
3838 rc = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, buf);
3846 * @writer: the xmlTextWriterPtr
3859 xmlTextWriterWriteDTDEntity(xmlTextWriterPtr writer,
3873 return xmlTextWriterWriteDTDInternalEntity(writer, pe, name,
3876 return xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid,
3882 * @writer: the xmlTextWriterPtr
3892 xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
3904 count = xmlTextWriterStartDTDEntity(writer, pe, name);
3909 count = xmlTextWriterWriteString(writer, content);
3914 count = xmlTextWriterEndDTDEntity(writer);
3924 * @writer: the xmlTextWriterPtr
3936 xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
3952 count = xmlTextWriterStartDTDEntity(writer, pe, name);
3958 xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid,
3964 count = xmlTextWriterEndDTDEntity(writer);
3974 * @writer: the xmlTextWriterPtr
3984 xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer,
3994 if (writer == NULL) {
3995 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4001 lk = xmlListFront(writer->nodes);
4003 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4017 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4023 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4030 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4035 count = xmlOutputBufferWriteString(writer->out, " PUBLIC ");
4040 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4046 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
4051 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4059 count = xmlOutputBufferWriteString(writer->out, " SYSTEM");
4065 count = xmlOutputBufferWriteString(writer->out, " ");
4070 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4076 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
4081 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4088 count = xmlOutputBufferWriteString(writer->out, " NDATA ");
4094 xmlOutputBufferWriteString(writer->out,
4106 * @writer: the xmlTextWriterPtr
4116 xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
4125 if (writer == NULL || name == NULL || *name == '\0')
4129 lk = xmlListFront(writer->nodes);
4138 count = xmlOutputBufferWriteString(writer->out, " [");
4142 if (writer->indent) {
4143 count = xmlOutputBufferWriteString(writer->out, "\n");
4157 if (writer->indent) {
4158 count = xmlTextWriterWriteIndent(writer);
4164 count = xmlOutputBufferWriteString(writer->out, "<!NOTATION ");
4168 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
4174 count = xmlOutputBufferWriteString(writer->out, " PUBLIC ");
4178 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4183 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
4187 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4195 count = xmlOutputBufferWriteString(writer->out, " SYSTEM");
4200 count = xmlOutputBufferWriteString(writer->out, " ");
4204 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4209 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
4213 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4219 count = xmlOutputBufferWriteString(writer->out, ">");
4229 * @writer: the xmlTextWriterPtr
4236 xmlTextWriterFlush(xmlTextWriterPtr writer)
4240 if (writer == NULL)
4243 if (writer->out == NULL)
4246 count = xmlOutputBufferFlush(writer->out);
4311 * @writer: the xmlTextWriterPtr
4316 xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer)
4324 while (!xmlListEmpty(writer->nsstack)) {
4328 lk = xmlListFront(writer->nsstack);
4336 xmlListPopFront(writer->nsstack);
4339 count = xmlTextWriterWriteAttribute(writer, prefix, namespaceURI);
4344 xmlListDelete(writer->nsstack);
4345 writer->nsstack = NULL;
4574 * @writer: the xmlTextWriterPtr
4582 xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent)
4584 if ((writer == NULL) || (indent < 0))
4587 writer->indent = indent;
4588 writer->doindent = 1;
4595 * @writer: the xmlTextWriterPtr
4603 xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str)
4605 if ((writer == NULL) || (!str))
4608 if (writer->ichar != NULL)
4609 xmlFree(writer->ichar);
4610 writer->ichar = xmlStrdup(str);
4612 if (!writer->ichar)
4620 * @writer: the xmlTextWriterPtr
4628 xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar)
4630 if ((writer == NULL) || ((quotechar != '\'') && (quotechar != '"')))
4633 writer->qchar = quotechar;
4640 * @writer: the xmlTextWriterPtr
4647 xmlTextWriterWriteIndent(xmlTextWriterPtr writer)
4653 lksize = xmlListSize(writer->nodes);
4657 ret = xmlOutputBufferWriteString(writer->out,
4658 (const char *) writer->ichar);
4668 * @writer: the xmlTextWriterPtr
4676 xmlTextWriterHandleStateDependencies(xmlTextWriterPtr writer,
4683 if (writer == NULL)
4696 count = xmlTextWriterOutputNSDecl(writer);
4723 extra[1] = writer->qchar;
4732 count = xmlOutputBufferWriteString(writer->out, extra);