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
468 * @writer: the xmlTextWriterPtr
470 * Deallocate all the resources associated to the writer
473 xmlFreeTextWriter(xmlTextWriterPtr writer)
475 if (writer == NULL)
478 if (writer->out != NULL)
479 xmlOutputBufferClose(writer->out);
481 if (writer->nodes != NULL)
482 xmlListDelete(writer->nodes);
484 if (writer->nsstack != NULL)
485 xmlListDelete(writer->nsstack);
487 if (writer->ctxt != NULL) {
488 if ((writer->ctxt->myDoc != NULL) && (writer->no_doc_free == 0)) {
489 xmlFreeDoc(writer->ctxt->myDoc);
490 writer->ctxt->myDoc = NULL;
492 xmlFreeParserCtxt(writer->ctxt);
495 if (writer->doc != NULL)
496 xmlFreeDoc(writer->doc);
498 if (writer->ichar != NULL)
499 xmlFree(writer->ichar);
500 xmlFree(writer);
505 * @writer: the xmlTextWriterPtr
515 xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version,
523 if ((writer == NULL) || (writer->out == NULL)) {
524 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
525 "xmlTextWriterStartDocument : invalid writer!\n");
529 lk = xmlListFront(writer->nodes);
531 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
540 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
546 writer->out->encoder = encoder;
548 if (writer->out->conv == NULL) {
549 writer->out->conv = xmlBufferCreateSize(4000);
551 xmlCharEncOutFunc(encoder, writer->out->conv, NULL);
552 if ((writer->doc != NULL) && (writer->doc->encoding == NULL))
553 writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name);
555 writer->out->conv = NULL;
558 count = xmlOutputBufferWriteString(writer->out, "<?xml version=");
562 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
567 count = xmlOutputBufferWriteString(writer->out, version);
569 count = xmlOutputBufferWriteString(writer->out, "1.0");
573 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
577 if (writer->out->encoder != 0) {
578 count = xmlOutputBufferWriteString(writer->out, " encoding=");
582 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
587 xmlOutputBufferWriteString(writer->out,
588 writer->out->encoder->name);
592 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
599 count = xmlOutputBufferWriteString(writer->out, " standalone=");
603 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
607 count = xmlOutputBufferWriteString(writer->out, standalone);
611 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
617 count = xmlOutputBufferWriteString(writer->out, "?>\n");
627 * @writer: the xmlTextWriterPtr
635 xmlTextWriterEndDocument(xmlTextWriterPtr writer)
642 if (writer == NULL) {
643 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
644 "xmlTextWriterEndDocument : invalid writer!\n");
649 while ((lk = xmlListFront(writer->nodes)) != NULL) {
657 count = xmlTextWriterEndElement(writer);
664 count = xmlTextWriterEndPI(writer);
670 count = xmlTextWriterEndCDATA(writer);
684 count = xmlTextWriterEndDTD(writer);
690 count = xmlTextWriterEndComment(writer);
700 if (!writer->indent) {
701 count = xmlOutputBufferWriteString(writer->out, "\n");
707 sum += xmlTextWriterFlush(writer);
714 * @writer: the xmlTextWriterPtr
721 xmlTextWriterStartComment(xmlTextWriterPtr writer)
728 if (writer == NULL) {
729 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
730 "xmlTextWriterStartComment : invalid writer!\n");
735 lk = xmlListFront(writer->nodes);
745 count = xmlTextWriterOutputNSDecl(writer);
749 count = xmlOutputBufferWriteString(writer->out, ">");
753 if (writer->indent) {
755 xmlOutputBufferWriteString(writer->out, "\n");
771 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
779 xmlListPushFront(writer->nodes, p);
781 if (writer->indent) {
782 count = xmlTextWriterWriteIndent(writer);
788 count = xmlOutputBufferWriteString(writer->out, "<!--");
798 * @writer: the xmlTextWriterPtr
805 xmlTextWriterEndComment(xmlTextWriterPtr writer)
812 if (writer == NULL) {
813 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
814 "xmlTextWriterEndComment : invalid writer!\n");
818 lk = xmlListFront(writer->nodes);
820 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
832 count = xmlOutputBufferWriteString(writer->out, "-->");
841 if (writer->indent) {
842 count = xmlOutputBufferWriteString(writer->out, "\n");
848 xmlListPopFront(writer->nodes);
854 * @writer: the xmlTextWriterPtr
863 xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
871 rc = xmlTextWriterWriteVFormatComment(writer, format, ap);
879 * @writer: the xmlTextWriterPtr
888 xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
894 if (writer == NULL) {
895 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
896 "xmlTextWriterWriteVFormatComment : invalid writer!\n");
904 rc = xmlTextWriterWriteComment(writer, buf);
912 * @writer: the xmlTextWriterPtr
920 xmlTextWriterWriteComment(xmlTextWriterPtr writer, const xmlChar * content)
926 count = xmlTextWriterStartComment(writer);
930 count = xmlTextWriterWriteString(writer, content);
934 count = xmlTextWriterEndComment(writer);
944 * @writer: the xmlTextWriterPtr
952 xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name)
959 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
963 lk = xmlListFront(writer->nodes);
974 count = xmlTextWriterEndAttribute(writer);
981 count = xmlTextWriterOutputNSDecl(writer);
985 count = xmlOutputBufferWriteString(writer->out, ">");
989 if (writer->indent)
991 xmlOutputBufferWriteString(writer->out, "\n");
1003 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1010 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1017 xmlListPushFront(writer->nodes, p);
1019 if (writer->indent) {
1020 count = xmlTextWriterWriteIndent(writer);
1024 count = xmlOutputBufferWriteString(writer->out, "<");
1029 xmlOutputBufferWriteString(writer->out, (const char *) p->name);
1039 * @writer: the xmlTextWriterPtr
1049 xmlTextWriterStartElementNS(xmlTextWriterPtr writer,
1057 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1068 count = xmlTextWriterStartElement(writer, buf);
1078 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1092 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1097 p->elem = xmlListFront(writer->nodes);
1099 xmlListPushFront(writer->nsstack, p);
1107 * @writer: the xmlTextWriterPtr
1114 xmlTextWriterEndElement(xmlTextWriterPtr writer)
1121 if (writer == NULL)
1124 lk = xmlListFront(writer->nodes);
1126 xmlListDelete(writer->nsstack);
1127 writer->nsstack = NULL;
1133 xmlListDelete(writer->nsstack);
1134 writer->nsstack = NULL;
1141 count = xmlTextWriterEndAttribute(writer);
1143 xmlListDelete(writer->nsstack);
1144 writer->nsstack = NULL;
1151 count = xmlTextWriterOutputNSDecl(writer);
1156 if (writer->indent) /* next element needs indent */
1157 writer->doindent = 1;
1158 count = xmlOutputBufferWriteString(writer->out, "/>");
1164 if ((writer->indent) && (writer->doindent)) {
1165 count = xmlTextWriterWriteIndent(writer);
1167 writer->doindent = 1;
1169 writer->doindent = 1;
1170 count = xmlOutputBufferWriteString(writer->out, "</");
1174 count = xmlOutputBufferWriteString(writer->out,
1179 count = xmlOutputBufferWriteString(writer->out, ">");
1188 if (writer->indent) {
1189 count = xmlOutputBufferWriteString(writer->out, "\n");
1193 xmlListPopFront(writer->nodes);
1199 * @writer: the xmlTextWriterPtr
1206 xmlTextWriterFullEndElement(xmlTextWriterPtr writer)
1213 if (writer == NULL)
1216 lk = xmlListFront(writer->nodes);
1227 count = xmlTextWriterEndAttribute(writer);
1234 count = xmlTextWriterOutputNSDecl(writer);
1239 count = xmlOutputBufferWriteString(writer->out, ">");
1243 if (writer->indent)
1244 writer->doindent = 0;
1247 if ((writer->indent) && (writer->doindent)) {
1248 count = xmlTextWriterWriteIndent(writer);
1250 writer->doindent = 1;
1252 writer->doindent = 1;
1253 count = xmlOutputBufferWriteString(writer->out, "</");
1257 count = xmlOutputBufferWriteString(writer->out,
1262 count = xmlOutputBufferWriteString(writer->out, ">");
1271 if (writer->indent) {
1272 count = xmlOutputBufferWriteString(writer->out, "\n");
1276 xmlListPopFront(writer->nodes);
1282 * @writer: the xmlTextWriterPtr
1291 xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, const char *format,
1299 rc = xmlTextWriterWriteVFormatRaw(writer, format, ap);
1307 * @writer: the xmlTextWriterPtr
1316 xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format,
1322 if (writer == NULL)
1329 rc = xmlTextWriterWriteRaw(writer, buf);
1337 * @writer: the xmlTextWriterPtr
1347 xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content,
1355 if (writer == NULL) {
1356 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
1357 "xmlTextWriterWriteRawLen : invalid writer!\n");
1362 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
1368 lk = xmlListFront(writer->nodes);
1371 count = xmlTextWriterHandleStateDependencies(writer, p);
1377 if (writer->indent)
1378 writer->doindent = 0;
1382 xmlOutputBufferWrite(writer->out, len, (const char *) content);
1393 * @writer: the xmlTextWriterPtr
1401 xmlTextWriterWriteRaw(xmlTextWriterPtr writer, const xmlChar * content)
1403 return xmlTextWriterWriteRawLen(writer, content, xmlStrlen(content));
1408 * @writer: the xmlTextWriterPtr
1417 xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format,
1423 if ((writer == NULL) || (format == NULL))
1428 rc = xmlTextWriterWriteVFormatString(writer, format, ap);
1436 * @writer: the xmlTextWriterPtr
1445 xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer,
1451 if ((writer == NULL) || (format == NULL))
1458 rc = xmlTextWriterWriteString(writer, buf);
1466 * @writer: the xmlTextWriterPtr
1474 xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content)
1482 if ((writer == NULL) || (content == NULL))
1487 lk = xmlListFront(writer->nodes);
1496 xmlOutputBufferWriteEscape(writer->out, content, NULL);
1502 xmlAttrSerializeTxtContent(writer->out->buffer, writer->doc,
1512 count = xmlTextWriterWriteRaw(writer, buf);
1608 * @writer: the xmlTextWriterPtr
1618 xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data,
1626 if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0))
1630 lk = xmlListFront(writer->nodes);
1634 count = xmlTextWriterHandleStateDependencies(writer, p);
1641 if (writer->indent)
1642 writer->doindent = 0;
1645 xmlOutputBufferWriteBase64(writer->out, len,
1701 * @writer: the xmlTextWriterPtr
1711 xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, const char *data,
1719 if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0))
1723 lk = xmlListFront(writer->nodes);
1727 count = xmlTextWriterHandleStateDependencies(writer, p);
1734 if (writer->indent)
1735 writer->doindent = 0;
1738 xmlOutputBufferWriteBinHex(writer->out, len,
1749 * @writer: the xmlTextWriterPtr
1757 xmlTextWriterStartAttribute(xmlTextWriterPtr writer, const xmlChar * name)
1764 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1768 lk = xmlListFront(writer->nodes);
1778 count = xmlTextWriterEndAttribute(writer);
1784 count = xmlOutputBufferWriteString(writer->out, " ");
1789 xmlOutputBufferWriteString(writer->out,
1794 count = xmlOutputBufferWriteString(writer->out, "=");
1798 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
1813 * @writer: the xmlTextWriterPtr
1823 xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer,
1832 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
1847 nsentry.elem = xmlListFront(writer->nodes);
1849 curns = (xmlTextWriterNsStackEntry *)xmlListSearch(writer->nsstack,
1867 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1875 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
1880 p->elem = xmlListFront(writer->nodes);
1882 xmlListPushFront(writer->nsstack, p);
1894 count = xmlTextWriterStartAttribute(writer, buf);
1905 * @writer: the xmlTextWriterPtr
1912 xmlTextWriterEndAttribute(xmlTextWriterPtr writer)
1919 if (writer == NULL)
1922 lk = xmlListFront(writer->nodes);
1937 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
1952 * @writer: the xmlTextWriterPtr
1962 xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
1971 rc = xmlTextWriterWriteVFormatAttribute(writer, name, format, ap);
1979 * @writer: the xmlTextWriterPtr
1989 xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
1996 if (writer == NULL)
2003 rc = xmlTextWriterWriteAttribute(writer, name, buf);
2011 * @writer: the xmlTextWriterPtr
2020 xmlTextWriterWriteAttribute(xmlTextWriterPtr writer, const xmlChar * name,
2027 count = xmlTextWriterStartAttribute(writer, name);
2031 count = xmlTextWriterWriteString(writer, content);
2035 count = xmlTextWriterEndAttribute(writer);
2045 * @writer: the xmlTextWriterPtr
2057 xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
2068 rc = xmlTextWriterWriteVFormatAttributeNS(writer, prefix, name,
2077 * @writer: the xmlTextWriterPtr
2089 xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
2098 if (writer == NULL)
2105 rc = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI,
2114 * @writer: the xmlTextWriterPtr
2125 xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer,
2133 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
2137 count = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
2141 count = xmlTextWriterWriteString(writer, content);
2145 count = xmlTextWriterEndAttribute(writer);
2155 * @writer: the xmlTextWriterPtr
2165 xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
2174 rc = xmlTextWriterWriteVFormatElement(writer, name, format, ap);
2182 * @writer: the xmlTextWriterPtr
2192 xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
2199 if (writer == NULL)
2206 rc = xmlTextWriterWriteElement(writer, name, buf);
2214 * @writer: the xmlTextWriterPtr
2223 xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name,
2230 count = xmlTextWriterStartElement(writer, name);
2234 count = xmlTextWriterWriteString(writer, content);
2238 count = xmlTextWriterEndElement(writer);
2248 * @writer: the xmlTextWriterPtr
2260 xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
2271 rc = xmlTextWriterWriteVFormatElementNS(writer, prefix, name,
2280 * @writer: the xmlTextWriterPtr
2292 xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
2301 if (writer == NULL)
2308 rc = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI,
2317 * @writer: the xmlTextWriterPtr
2328 xmlTextWriterWriteElementNS(xmlTextWriterPtr writer,
2336 if ((writer == NULL) || (name == NULL) || (*name == '\0'))
2341 xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
2345 count = xmlTextWriterWriteString(writer, content);
2349 count = xmlTextWriterEndElement(writer);
2359 * @writer: the xmlTextWriterPtr
2367 xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target)
2374 if ((writer == NULL) || (target == NULL) || (*target == '\0'))
2378 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2384 lk = xmlListFront(writer->nodes);
2390 count = xmlTextWriterEndAttribute(writer);
2397 count = xmlTextWriterOutputNSDecl(writer);
2401 count = xmlOutputBufferWriteString(writer->out, ">");
2413 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2425 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2432 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2439 xmlListPushFront(writer->nodes, p);
2441 count = xmlOutputBufferWriteString(writer->out, "<?");
2446 xmlOutputBufferWriteString(writer->out, (const char *) p->name);
2456 * @writer: the xmlTextWriterPtr
2463 xmlTextWriterEndPI(xmlTextWriterPtr writer)
2470 if (writer == NULL)
2473 lk = xmlListFront(writer->nodes);
2485 count = xmlOutputBufferWriteString(writer->out, "?>");
2494 if (writer->indent) {
2495 count = xmlOutputBufferWriteString(writer->out, "\n");
2501 xmlListPopFront(writer->nodes);
2507 * @writer: the xmlTextWriterPtr
2517 xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target,
2525 rc = xmlTextWriterWriteVFormatPI(writer, target, format, ap);
2533 * @writer: the xmlTextWriterPtr
2543 xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
2550 if (writer == NULL)
2557 rc = xmlTextWriterWritePI(writer, target, buf);
2565 * @writer: the xmlTextWriterPtr
2574 xmlTextWriterWritePI(xmlTextWriterPtr writer, const xmlChar * target,
2581 count = xmlTextWriterStartPI(writer, target);
2586 count = xmlTextWriterWriteString(writer, content);
2591 count = xmlTextWriterEndPI(writer);
2601 * @writer: the xmlTextWriterPtr
2608 xmlTextWriterStartCDATA(xmlTextWriterPtr writer)
2615 if (writer == NULL)
2619 lk = xmlListFront(writer->nodes);
2630 count = xmlTextWriterEndAttribute(writer);
2637 count = xmlTextWriterOutputNSDecl(writer);
2641 count = xmlOutputBufferWriteString(writer->out, ">");
2648 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2660 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2668 xmlListPushFront(writer->nodes, p);
2670 count = xmlOutputBufferWriteString(writer->out, "<![CDATA[");
2680 * @writer: the xmlTextWriterPtr
2687 xmlTextWriterEndCDATA(xmlTextWriterPtr writer)
2694 if (writer == NULL)
2697 lk = xmlListFront(writer->nodes);
2708 count = xmlOutputBufferWriteString(writer->out, "]]>");
2717 xmlListPopFront(writer->nodes);
2723 * @writer: the xmlTextWriterPtr
2732 xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format,
2740 rc = xmlTextWriterWriteVFormatCDATA(writer, format, ap);
2748 * @writer: the xmlTextWriterPtr
2757 xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format,
2763 if (writer == NULL)
2770 rc = xmlTextWriterWriteCDATA(writer, buf);
2778 * @writer: the xmlTextWriterPtr
2786 xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, const xmlChar * content)
2792 count = xmlTextWriterStartCDATA(writer);
2797 count = xmlTextWriterWriteString(writer, content);
2802 count = xmlTextWriterEndCDATA(writer);
2812 * @writer: the xmlTextWriterPtr
2822 xmlTextWriterStartDTD(xmlTextWriterPtr writer,
2831 if (writer == NULL || name == NULL || *name == '\0')
2835 lk = xmlListFront(writer->nodes);
2837 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2845 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2852 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
2859 xmlListPushFront(writer->nodes, p);
2861 count = xmlOutputBufferWriteString(writer->out, "<!DOCTYPE ");
2865 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
2872 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
2877 if (writer->indent)
2878 count = xmlOutputBufferWrite(writer->out, 1, "\n");
2880 count = xmlOutputBufferWrite(writer->out, 1, " ");
2885 count = xmlOutputBufferWriteString(writer->out, "PUBLIC ");
2890 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2896 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
2901 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2909 if (writer->indent)
2910 count = xmlOutputBufferWrite(writer->out, 1, "\n");
2912 count = xmlOutputBufferWrite(writer->out, 1, " ");
2916 count = xmlOutputBufferWriteString(writer->out, "SYSTEM ");
2921 if (writer->indent)
2922 count = xmlOutputBufferWriteString(writer->out, "\n ");
2924 count = xmlOutputBufferWrite(writer->out, 1, " ");
2930 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2936 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
2941 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
2952 * @writer: the xmlTextWriterPtr
2959 xmlTextWriterEndDTD(xmlTextWriterPtr writer)
2967 if (writer == NULL)
2973 lk = xmlListFront(writer->nodes);
2981 count = xmlOutputBufferWriteString(writer->out, "]");
2987 count = xmlOutputBufferWriteString(writer->out, ">");
2989 if (writer->indent) {
2993 count = xmlOutputBufferWriteString(writer->out, "\n");
2996 xmlListPopFront(writer->nodes);
3000 count = xmlTextWriterEndDTDElement(writer);
3004 count = xmlTextWriterEndDTDAttlist(writer);
3009 count = xmlTextWriterEndDTDEntity(writer);
3012 count = xmlTextWriterEndComment(writer);
3029 * @writer: the xmlTextWriterPtr
3041 xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
3051 rc = xmlTextWriterWriteVFormatDTD(writer, name, pubid, sysid, format,
3060 * @writer: the xmlTextWriterPtr
3072 xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
3081 if (writer == NULL)
3088 rc = xmlTextWriterWriteDTD(writer, name, pubid, sysid, buf);
3096 * @writer: the xmlTextWriterPtr
3107 xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
3116 count = xmlTextWriterStartDTD(writer, name, pubid, sysid);
3121 count = xmlTextWriterWriteString(writer, subset);
3126 count = xmlTextWriterEndDTD(writer);
3136 * @writer: the xmlTextWriterPtr
3144 xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, const xmlChar * name)
3151 if (writer == NULL || name == NULL || *name == '\0')
3155 lk = xmlListFront(writer->nodes);
3164 count = xmlOutputBufferWriteString(writer->out, " [");
3168 if (writer->indent) {
3169 count = xmlOutputBufferWriteString(writer->out, "\n");
3187 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3194 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3201 xmlListPushFront(writer->nodes, p);
3203 if (writer->indent) {
3204 count = xmlTextWriterWriteIndent(writer);
3210 count = xmlOutputBufferWriteString(writer->out, "<!ELEMENT ");
3214 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3224 * @writer: the xmlTextWriterPtr
3231 xmlTextWriterEndDTDElement(xmlTextWriterPtr writer)
3238 if (writer == NULL)
3242 lk = xmlListFront(writer->nodes);
3253 count = xmlOutputBufferWriteString(writer->out, ">");
3262 if (writer->indent) {
3263 count = xmlOutputBufferWriteString(writer->out, "\n");
3269 xmlListPopFront(writer->nodes);
3275 * @writer: the xmlTextWriterPtr
3285 xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
3294 rc = xmlTextWriterWriteVFormatDTDElement(writer, name, format, ap);
3302 * @writer: the xmlTextWriterPtr
3312 xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
3319 if (writer == NULL)
3326 rc = xmlTextWriterWriteDTDElement(writer, name, buf);
3334 * @writer: the xmlTextWriterPtr
3343 xmlTextWriterWriteDTDElement(xmlTextWriterPtr writer,
3353 count = xmlTextWriterStartDTDElement(writer, name);
3358 count = xmlTextWriterWriteString(writer, content);
3363 count = xmlTextWriterEndDTDElement(writer);
3373 * @writer: the xmlTextWriterPtr
3381 xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name)
3388 if (writer == NULL || name == NULL || *name == '\0')
3392 lk = xmlListFront(writer->nodes);
3401 count = xmlOutputBufferWriteString(writer->out, " [");
3405 if (writer->indent) {
3406 count = xmlOutputBufferWriteString(writer->out, "\n");
3424 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3431 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3438 xmlListPushFront(writer->nodes, p);
3440 if (writer->indent) {
3441 count = xmlTextWriterWriteIndent(writer);
3447 count = xmlOutputBufferWriteString(writer->out, "<!ATTLIST ");
3451 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3461 * @writer: the xmlTextWriterPtr
3468 xmlTextWriterEndDTDAttlist(xmlTextWriterPtr writer)
3475 if (writer == NULL)
3479 lk = xmlListFront(writer->nodes);
3490 count = xmlOutputBufferWriteString(writer->out, ">");
3499 if (writer->indent) {
3500 count = xmlOutputBufferWriteString(writer->out, "\n");
3506 xmlListPopFront(writer->nodes);
3512 * @writer: the xmlTextWriterPtr
3522 xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
3531 rc = xmlTextWriterWriteVFormatDTDAttlist(writer, name, format, ap);
3539 * @writer: the xmlTextWriterPtr
3549 xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
3556 if (writer == NULL)
3563 rc = xmlTextWriterWriteDTDAttlist(writer, name, buf);
3571 * @writer: the xmlTextWriterPtr
3580 xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr writer,
3590 count = xmlTextWriterStartDTDAttlist(writer, name);
3595 count = xmlTextWriterWriteString(writer, content);
3600 count = xmlTextWriterEndDTDAttlist(writer);
3610 * @writer: the xmlTextWriterPtr
3619 xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
3627 if (writer == NULL || name == NULL || *name == '\0')
3631 lk = xmlListFront(writer->nodes);
3638 count = xmlOutputBufferWriteString(writer->out, " [");
3642 if (writer->indent) {
3644 xmlOutputBufferWriteString(writer->out, "\n");
3663 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3670 xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY,
3681 xmlListPushFront(writer->nodes, p);
3683 if (writer->indent) {
3684 count = xmlTextWriterWriteIndent(writer);
3690 count = xmlOutputBufferWriteString(writer->out, "<!ENTITY ");
3696 count = xmlOutputBufferWriteString(writer->out, "% ");
3702 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
3712 * @writer: the xmlTextWriterPtr
3719 xmlTextWriterEndDTDEntity(xmlTextWriterPtr writer)
3726 if (writer == NULL)
3730 lk = xmlListFront(writer->nodes);
3740 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
3746 count = xmlOutputBufferWriteString(writer->out, ">");
3755 if (writer->indent) {
3756 count = xmlOutputBufferWriteString(writer->out, "\n");
3762 xmlListPopFront(writer->nodes);
3768 * @writer: the xmlTextWriterPtr
3779 xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
3789 rc = xmlTextWriterWriteVFormatDTDInternalEntity(writer, pe, name,
3798 * @writer: the xmlTextWriterPtr
3809 xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
3818 if (writer == NULL)
3825 rc = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, buf);
3833 * @writer: the xmlTextWriterPtr
3846 xmlTextWriterWriteDTDEntity(xmlTextWriterPtr writer,
3860 return xmlTextWriterWriteDTDInternalEntity(writer, pe, name,
3863 return xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid,
3869 * @writer: the xmlTextWriterPtr
3879 xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
3891 count = xmlTextWriterStartDTDEntity(writer, pe, name);
3896 count = xmlTextWriterWriteString(writer, content);
3901 count = xmlTextWriterEndDTDEntity(writer);
3911 * @writer: the xmlTextWriterPtr
3923 xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
3939 count = xmlTextWriterStartDTDEntity(writer, pe, name);
3945 xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid,
3951 count = xmlTextWriterEndDTDEntity(writer);
3961 * @writer: the xmlTextWriterPtr
3971 xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer,
3981 if (writer == NULL) {
3982 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
3988 lk = xmlListFront(writer->nodes);
3990 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4004 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4010 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4017 xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR,
4022 count = xmlOutputBufferWriteString(writer->out, " PUBLIC ");
4027 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4033 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
4038 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4046 count = xmlOutputBufferWriteString(writer->out, " SYSTEM");
4052 count = xmlOutputBufferWriteString(writer->out, " ");
4057 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4063 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
4068 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4075 count = xmlOutputBufferWriteString(writer->out, " NDATA ");
4081 xmlOutputBufferWriteString(writer->out,
4093 * @writer: the xmlTextWriterPtr
4103 xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
4112 if (writer == NULL || name == NULL || *name == '\0')
4116 lk = xmlListFront(writer->nodes);
4125 count = xmlOutputBufferWriteString(writer->out, " [");
4129 if (writer->indent) {
4130 count = xmlOutputBufferWriteString(writer->out, "\n");
4144 if (writer->indent) {
4145 count = xmlTextWriterWriteIndent(writer);
4151 count = xmlOutputBufferWriteString(writer->out, "<!NOTATION ");
4155 count = xmlOutputBufferWriteString(writer->out, (const char *) name);
4161 count = xmlOutputBufferWriteString(writer->out, " PUBLIC ");
4165 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4170 xmlOutputBufferWriteString(writer->out, (const char *) pubid);
4174 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4182 count = xmlOutputBufferWriteString(writer->out, " SYSTEM");
4187 count = xmlOutputBufferWriteString(writer->out, " ");
4191 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4196 xmlOutputBufferWriteString(writer->out, (const char *) sysid);
4200 count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar);
4206 count = xmlOutputBufferWriteString(writer->out, ">");
4216 * @writer: the xmlTextWriterPtr
4223 xmlTextWriterFlush(xmlTextWriterPtr writer)
4227 if (writer == NULL)
4230 if (writer->out == NULL)
4233 count = xmlOutputBufferFlush(writer->out);
4298 * @writer: the xmlTextWriterPtr
4303 xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer)
4311 while (!xmlListEmpty(writer->nsstack)) {
4315 lk = xmlListFront(writer->nsstack);
4323 xmlListPopFront(writer->nsstack);
4326 count = xmlTextWriterWriteAttribute(writer, prefix, namespaceURI);
4331 xmlListDelete(writer->nsstack);
4332 writer->nsstack = NULL;
4561 * @writer: the xmlTextWriterPtr
4569 xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent)
4571 if ((writer == NULL) || (indent < 0))
4574 writer->indent = indent;
4575 writer->doindent = 1;
4582 * @writer: the xmlTextWriterPtr
4590 xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str)
4592 if ((writer == NULL) || (!str))
4595 if (writer->ichar != NULL)
4596 xmlFree(writer->ichar);
4597 writer->ichar = xmlStrdup(str);
4599 if (!writer->ichar)
4607 * @writer: the xmlTextWriterPtr
4614 xmlTextWriterWriteIndent(xmlTextWriterPtr writer)
4620 lksize = xmlListSize(writer->nodes);
4624 ret = xmlOutputBufferWriteString(writer->out,
4625 (const char *) writer->ichar);
4635 * @writer: the xmlTextWriterPtr
4643 xmlTextWriterHandleStateDependencies(xmlTextWriterPtr writer,
4650 if (writer == NULL)
4663 count = xmlTextWriterOutputNSDecl(writer);
4690 extra[1] = writer->qchar;
4699 count = xmlOutputBufferWriteString(writer->out, extra);