31#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
32 "-//W3C//DTD XHTML 1.0 Strict//EN"
33#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
34 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
35#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
36 "-//W3C//DTD XHTML 1.0 Frameset//EN"
37#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
38 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
39#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
40 "-//W3C//DTD XHTML 1.0 Transitional//EN"
41#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
42 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
44#define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml"
56 if ((systemID ==
NULL) && (publicID ==
NULL))
58 if (publicID !=
NULL) {
63 if (systemID !=
NULL) {
71#ifdef LIBXML_OUTPUT_ENABLED
74 xmlGenericError(xmlGenericErrorContext, \
75 "Unimplemented block at %s:%d\n", \
108xmlSaveErrMemory(
const char *
extra)
128 msg =
"string is not in UTF-8\n";
131 msg =
"invalid character value\n";
134 msg =
"unknown encoding %s\n";
137 msg =
"document has no DOCTYPE\n";
140 msg =
"unexpected error number\n";
150static unsigned char *
151xmlSerializeHexCharRef(
unsigned char *
out,
int val) {
166 case 0: *
ptr-- =
'0';
break;
167 case 1: *
ptr-- =
'1';
break;
168 case 2: *
ptr-- =
'2';
break;
169 case 3: *
ptr-- =
'3';
break;
170 case 4: *
ptr-- =
'4';
break;
171 case 5: *
ptr-- =
'5';
break;
172 case 6: *
ptr-- =
'6';
break;
173 case 7: *
ptr-- =
'7';
break;
174 case 8: *
ptr-- =
'8';
break;
175 case 9: *
ptr-- =
'9';
break;
176 case 0xA: *
ptr-- =
'A';
break;
177 case 0xB: *
ptr-- =
'B';
break;
178 case 0xC: *
ptr-- =
'C';
break;
179 case 0xD: *
ptr-- =
'D';
break;
180 case 0xE: *
ptr-- =
'E';
break;
181 case 0xF: *
ptr-- =
'F';
break;
182 default: *
ptr-- =
'0';
break;
207xmlEscapeEntities(
unsigned char*
out,
int *outlen,
209 unsigned char* outstart =
out;
210 const unsigned char*
base =
in;
211 unsigned char* outend =
out + *outlen;
212 const unsigned char* inend;
215 inend =
in + (*inlen);
217 while ((
in < inend) && (
out < outend)) {
219 if (outend -
out < 4)
break;
226 }
else if (*
in ==
'>') {
227 if (outend -
out < 4)
break;
234 }
else if (*
in ==
'&') {
235 if (outend -
out < 5)
break;
243 }
else if (((*
in >= 0x20) && (*
in < 0x80)) ||
244 (*
in ==
'\n') || (*
in ==
'\t')) {
250 }
else if (*
in >= 0x80) {
254 if (outend -
out < 11)
break;
260 }
else if (*
in < 0xE0) {
261 if (inend -
in < 2)
break;
262 val = (
in[0]) & 0x1F;
264 val |= (
in[1]) & 0x3F;
266 }
else if (*
in < 0xF0) {
267 if (inend -
in < 3)
break;
268 val = (
in[0]) & 0x0F;
270 val |= (
in[1]) & 0x3F;
272 val |= (
in[2]) & 0x3F;
274 }
else if (*
in < 0xF8) {
275 if (inend -
in < 4)
break;
276 val = (
in[0]) & 0x07;
278 val |= (
in[1]) & 0x3F;
280 val |= (
in[2]) & 0x3F;
282 val |= (
in[3]) & 0x3F;
300 if (outend -
out < 6)
break;
301 out = xmlSerializeHexCharRef(
out, *
in++);
304 "xmlEscapeEntities : char out of range\n");
309 *outlen =
out - outstart;
313 *outlen =
out - outstart;
330xmlSaveCtxtInit(xmlSaveCtxtPtr ctxt)
335 if (ctxt ==
NULL)
return;
336 if ((ctxt->encoding ==
NULL) && (ctxt->escape ==
NULL))
337 ctxt->escape = xmlEscapeEntities;
342 ctxt->indent_size =
len;
343 ctxt->indent_nr =
MAX_INDENT / ctxt->indent_size;
344 for (
i = 0;
i < ctxt->indent_nr;
i++)
347 ctxt->indent[ctxt->indent_nr * ctxt->indent_size] = 0;
351 ctxt->options |= XML_SAVE_NO_EMPTY;
361xmlFreeSaveCtxt(xmlSaveCtxtPtr ctxt)
363 if (ctxt ==
NULL)
return;
364 if (ctxt->encoding !=
NULL)
365 xmlFree((
char *) ctxt->encoding);
366 if (ctxt->buf !=
NULL)
367 xmlOutputBufferClose(ctxt->buf);
385 xmlSaveErrMemory(
"creating saving context");
394 xmlFreeSaveCtxt(
ret);
400 xmlSaveCtxtInit(
ret);
407 if ((
ret->options & XML_SAVE_NO_EMPTY) && ! (
options & XML_SAVE_NO_EMPTY)) {
414 else if (
options & XML_SAVE_WSNONSIG)
438 children =
attr->children;
439 while (children !=
NULL) {
440 switch (children->
type) {
442 xmlBufAttrSerializeTxtContent(
buf->buffer,
attr->doc,
455 children = children->
next;
549 xmlDumpEntityDecl(
buffer, ent);
559static int xmlSaveSwitchEncoding(xmlSaveCtxtPtr ctxt,
const char *
encoding) {
572 xmlSaveErrMemory(
"creating encoding buffer");
583static int xmlSaveClearEncoding(xmlSaveCtxtPtr ctxt) {
585 xmlOutputBufferFlush(
buf);
593#ifdef LIBXML_HTML_ENABLED
597static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt,
xmlNodePtr cur);
599static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt,
xmlDocPtr cur);
609xmlOutputBufferWriteWSNonSig(xmlSaveCtxtPtr ctxt,
int extra)
612 if ((ctxt ==
NULL) || (ctxt->buf ==
NULL))
614 xmlOutputBufferWrite(ctxt->buf, 1,
"\n");
615 for (
i = 0;
i < (ctxt->level +
extra);
i += ctxt->indent_nr) {
616 xmlOutputBufferWrite(ctxt->buf, ctxt->indent_size *
617 ((ctxt->level +
extra -
i) > ctxt->indent_nr ?
618 ctxt->indent_nr : (ctxt->level +
extra -
i)),
640 if (ctxt !=
NULL && ctxt->format == 2)
641 xmlOutputBufferWriteWSNonSig(ctxt, 2);
643 xmlOutputBufferWrite(
buf, 1,
" ");
647 xmlOutputBufferWrite(
buf, 6,
"xmlns:");
648 xmlOutputBufferWriteString(
buf, (
const char *)
cur->prefix);
650 xmlOutputBufferWrite(
buf, 5,
"xmlns");
651 xmlOutputBufferWrite(
buf, 1,
"=");
665xmlNsDumpOutputCtxt(xmlSaveCtxtPtr ctxt,
xmlNsPtr cur) {
666 xmlNsDumpOutput(ctxt->buf,
cur, ctxt);
678xmlNsListDumpOutputCtxt(xmlSaveCtxtPtr ctxt,
xmlNsPtr cur) {
680 xmlNsDumpOutput(ctxt->buf,
cur, ctxt);
709xmlDtdDumpOutput(xmlSaveCtxtPtr ctxt,
xmlDtdPtr dtd) {
714 if (dtd ==
NULL)
return;
715 if ((ctxt ==
NULL) || (ctxt->buf ==
NULL))
718 xmlOutputBufferWrite(
buf, 10,
"<!DOCTYPE ");
719 xmlOutputBufferWriteString(
buf, (
const char *)dtd->
name);
721 xmlOutputBufferWrite(
buf, 8,
" PUBLIC ");
723 xmlOutputBufferWrite(
buf, 1,
" ");
726 xmlOutputBufferWrite(
buf, 8,
" SYSTEM ");
732 xmlOutputBufferWrite(
buf, 1,
">");
735 xmlOutputBufferWrite(
buf, 3,
" [\n");
741 (dtd->
doc->intSubset == dtd))) {
742 xmlBufDumpNotationTable(
buf->buffer,
750 xmlNodeDumpOutputInternal(ctxt,
cur);
754 xmlOutputBufferWrite(
buf, 2,
"]>");
771 if (ctxt->format == 2)
772 xmlOutputBufferWriteWSNonSig(ctxt, 2);
774 xmlOutputBufferWrite(
buf, 1,
" ");
776 xmlOutputBufferWriteString(
buf, (
const char *)
cur->ns->prefix);
777 xmlOutputBufferWrite(
buf, 1,
":");
779 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
780 xmlOutputBufferWrite(
buf, 2,
"=\"");
781 xmlAttrSerializeContent(
buf,
cur);
782 xmlOutputBufferWrite(
buf, 1,
"\"");
785#ifdef LIBXML_HTML_ENABLED
793htmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt,
xmlNodePtr cur) {
795 const xmlChar *oldctxtenc = ctxt->encoding;
798 int switched_encoding = 0;
806 if (ctxt->encoding !=
NULL) {
816 encoding = htmlGetMetaEncoding(doc);
821 if (xmlSaveSwitchEncoding(ctxt, (
const char*)
encoding) < 0) {
825 switched_encoding = 1;
827 if (ctxt->options & XML_SAVE_FORMAT)
828 htmlNodeDumpFormatOutput(
buf, doc,
cur,
831 htmlNodeDumpFormatOutput(
buf, doc,
cur,
836 if ((switched_encoding) && (oldctxtenc ==
NULL)) {
837 xmlSaveClearEncoding(ctxt);
852xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt,
xmlNodePtr cur) {
853 int format = ctxt->format;
897 if ((
cur !=
root) && (ctxt->format == 1) &&
899 xmlOutputBufferWrite(
buf, ctxt->indent_size *
900 (ctxt->level > ctxt->indent_nr ?
901 ctxt->indent_nr : ctxt->level),
910 xmlNodeDumpOutputInternal(ctxt,
cur);
914 xmlOutputBufferWrite(
buf, 1,
"<");
916 xmlOutputBufferWriteString(
buf, (
const char *)
cur->ns->prefix);
917 xmlOutputBufferWrite(
buf, 1,
":");
919 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
921 xmlNsListDumpOutputCtxt(ctxt,
cur->nsDef);
923 xmlAttrDumpOutput(ctxt,
attr);
926 if ((ctxt->options & XML_SAVE_NO_EMPTY) == 0) {
927 if (ctxt->format == 2)
928 xmlOutputBufferWriteWSNonSig(ctxt, 0);
929 xmlOutputBufferWrite(
buf, 2,
"/>");
931 if (ctxt->format == 2)
932 xmlOutputBufferWriteWSNonSig(ctxt, 1);
933 xmlOutputBufferWrite(
buf, 3,
"></");
935 xmlOutputBufferWriteString(
buf,
936 (
const char *)
cur->ns->prefix);
937 xmlOutputBufferWrite(
buf, 1,
":");
939 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
940 if (ctxt->format == 2)
941 xmlOutputBufferWriteWSNonSig(ctxt, 0);
942 xmlOutputBufferWrite(
buf, 1,
">");
945 if (ctxt->format == 1) {
947 while (tmp !=
NULL) {
952 unformattedNode =
cur;
958 if (ctxt->format == 2)
959 xmlOutputBufferWriteWSNonSig(ctxt, 1);
960 xmlOutputBufferWrite(
buf, 1,
">");
961 if (ctxt->format == 1) xmlOutputBufferWrite(
buf, 1,
"\n");
962 if (ctxt->level >= 0) ctxt->level++;
974 xmlOutputBufferWriteEscape(
buf,
cur->content, ctxt->escape);
979 xmlOutputBufferWriteString(
buf, (
const char *)
cur->content);
985 xmlOutputBufferWrite(
buf, ctxt->indent_size *
986 (ctxt->level > ctxt->indent_nr ?
987 ctxt->indent_nr : ctxt->level),
991 xmlOutputBufferWrite(
buf, 2,
"<?");
992 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
994 if (ctxt->format == 2)
995 xmlOutputBufferWriteWSNonSig(ctxt, 0);
997 xmlOutputBufferWrite(
buf, 1,
" ");
998 xmlOutputBufferWriteString(
buf,
999 (
const char *)
cur->content);
1001 xmlOutputBufferWrite(
buf, 2,
"?>");
1003 xmlOutputBufferWrite(
buf, 2,
"<?");
1004 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1005 if (ctxt->format == 2)
1006 xmlOutputBufferWriteWSNonSig(ctxt, 0);
1007 xmlOutputBufferWrite(
buf, 2,
"?>");
1013 xmlOutputBufferWrite(
buf, ctxt->indent_size *
1014 (ctxt->level > ctxt->indent_nr ?
1015 ctxt->indent_nr : ctxt->level),
1019 xmlOutputBufferWrite(
buf, 4,
"<!--");
1020 xmlOutputBufferWriteString(
buf, (
const char *)
cur->content);
1021 xmlOutputBufferWrite(
buf, 3,
"-->");
1026 xmlOutputBufferWrite(
buf, 1,
"&");
1027 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1028 xmlOutputBufferWrite(
buf, 1,
";");
1032 if (
cur->content ==
NULL || *
cur->content ==
'\0') {
1033 xmlOutputBufferWrite(
buf, 12,
"<![CDATA[]]>");
1036 while (*
end !=
'\0') {
1037 if ((*
end ==
']') && (*(
end + 1) ==
']') &&
1038 (*(
end + 2) ==
'>')) {
1040 xmlOutputBufferWrite(
buf, 9,
"<![CDATA[");
1042 (
const char *)
start);
1043 xmlOutputBufferWrite(
buf, 3,
"]]>");
1049 xmlOutputBufferWrite(
buf, 9,
"<![CDATA[");
1050 xmlOutputBufferWriteString(
buf, (
const char *)
start);
1051 xmlOutputBufferWrite(
buf, 3,
"]]>");
1071 if ((ctxt->format == 1) &&
1074 xmlOutputBufferWrite(
buf, 1,
"\n");
1085 if (ctxt->level > 0) ctxt->level--;
1087 xmlOutputBufferWrite(
buf, ctxt->indent_size *
1088 (ctxt->level > ctxt->indent_nr ?
1089 ctxt->indent_nr : ctxt->level),
1092 xmlOutputBufferWrite(
buf, 2,
"</");
1094 xmlOutputBufferWriteString(
buf,
1095 (
const char *)
cur->ns->prefix);
1096 xmlOutputBufferWrite(
buf, 1,
":");
1099 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1100 if (ctxt->format == 2)
1101 xmlOutputBufferWriteWSNonSig(ctxt, 0);
1102 xmlOutputBufferWrite(
buf, 1,
">");
1104 if (
cur == unformattedNode) {
1106 unformattedNode =
NULL;
1120xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt,
xmlDocPtr cur) {
1121#ifdef LIBXML_HTML_ENABLED
1126 const xmlChar *oldctxtenc = ctxt->encoding;
1132 int switched_encoding = 0;
1140 if (ctxt->encoding !=
NULL) {
1142 }
else if (
cur->encoding !=
NULL) {
1147 ((ctxt->options & XML_SAVE_AS_XML) == 0) &&
1148 ((ctxt->options & XML_SAVE_XHTML) == 0)) ||
1149 (ctxt->options & XML_SAVE_AS_HTML)) {
1150#ifdef LIBXML_HTML_ENABLED
1159 if (xmlSaveSwitchEncoding(ctxt, (
const char*)
encoding) < 0) {
1160 cur->encoding = oldenc;
1164 if (ctxt->options & XML_SAVE_FORMAT)
1165 htmlDocContentDumpFormatOutput(
buf,
cur,
1168 htmlDocContentDumpFormatOutput(
buf,
cur,
1170 if (ctxt->encoding !=
NULL)
1171 cur->encoding = oldenc;
1177 (ctxt->options & XML_SAVE_AS_XML) ||
1178 (ctxt->options & XML_SAVE_XHTML)) {
1182 ((ctxt->options & XML_SAVE_NO_DECL) == 0)) {
1191 if (xmlSaveSwitchEncoding(ctxt, (
const char*)
encoding) < 0) {
1192 cur->encoding = oldenc;
1195 switched_encoding = 1;
1197 if (ctxt->escape == xmlEscapeEntities)
1198 ctxt->escape =
NULL;
1199 if (ctxt->escapeAttr == xmlEscapeEntities)
1200 ctxt->escapeAttr =
NULL;
1207 if ((ctxt->options & XML_SAVE_NO_DECL) == 0) {
1208 xmlOutputBufferWrite(
buf, 14,
"<?xml version=");
1212 xmlOutputBufferWrite(
buf, 5,
"\"1.0\"");
1214 xmlOutputBufferWrite(
buf, 10,
" encoding=");
1217 switch (
cur->standalone) {
1219 xmlOutputBufferWrite(
buf, 16,
" standalone=\"no\"");
1222 xmlOutputBufferWrite(
buf, 17,
" standalone=\"yes\"");
1225 xmlOutputBufferWrite(
buf, 3,
"?>\n");
1228#ifdef LIBXML_HTML_ENABLED
1229 if (ctxt->options & XML_SAVE_XHTML)
1231 if ((ctxt->options & XML_SAVE_NO_XHTML) == 0) {
1235 if (is_xhtml < 0) is_xhtml = 0;
1244#ifdef LIBXML_HTML_ENABLED
1246 xhtmlNodeDumpOutput(ctxt,
child);
1249 xmlNodeDumpOutputInternal(ctxt,
child);
1252 xmlOutputBufferWrite(
buf, 1,
"\n");
1261 if ((switched_encoding) && (oldctxtenc ==
NULL)) {
1262 xmlSaveClearEncoding(ctxt);
1263 ctxt->escape = oldescape;
1264 ctxt->escapeAttr = oldescapeAttr;
1266 cur->encoding = oldenc;
1270#ifdef LIBXML_HTML_ENABLED
1295 switch (
node->name[0]) {
1351xhtmlAttrListDumpOutput(xmlSaveCtxtPtr ctxt,
xmlAttrPtr cur) {
1377 (
cur->children->content ==
NULL) ||
1378 (
cur->children->content[0] == 0)) &&
1379 (htmlIsBooleanAttr(
cur->name))) {
1386 xmlAttrDumpOutput(ctxt,
cur);
1403 xmlOutputBufferWrite(
buf, 5,
" id=\"");
1404 xmlAttrSerializeContent(
buf,
name);
1405 xmlOutputBufferWrite(
buf, 1,
"\"");
1412 xmlOutputBufferWrite(
buf, 11,
" xml:lang=\"");
1413 xmlAttrSerializeContent(
buf,
lang);
1414 xmlOutputBufferWrite(
buf, 1,
"\"");
1417 xmlOutputBufferWrite(
buf, 7,
" lang=\"");
1418 xmlAttrSerializeContent(
buf, xml_lang);
1419 xmlOutputBufferWrite(
buf, 1,
"\"");
1436 int format = ctxt->format, addmeta;
1445 switch (
cur->type) {
1460 if (
cur->children) {
1482 xmlOutputBufferWrite(
buf, ctxt->indent_size *
1483 (ctxt->level > ctxt->indent_nr ?
1484 ctxt->indent_nr : ctxt->level),
1487 xmlOutputBufferWrite(
buf, 1,
"<");
1489 xmlOutputBufferWriteString(
buf, (
const char *)
cur->ns->prefix);
1490 xmlOutputBufferWrite(
buf, 1,
":");
1493 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1495 xmlNsListDumpOutputCtxt(ctxt,
cur->nsDef);
1501 xmlOutputBufferWriteString(
buf,
1502 " xmlns=\"http://www.w3.org/1999/xhtml\"");
1505 xhtmlAttrListDumpOutput(ctxt,
cur->properties);
1512 tmp =
cur->children;
1513 while (tmp !=
NULL) {
1518 if (httpequiv !=
NULL) {
1535 ((xhtmlIsEmpty(
cur) == 1) && (addmeta == 0))) {
1539 xmlOutputBufferWrite(
buf, 3,
" />");
1542 xmlOutputBufferWrite(
buf, 1,
">");
1543 if (ctxt->format == 1) {
1544 xmlOutputBufferWrite(
buf, 1,
"\n");
1546 xmlOutputBufferWrite(
buf, ctxt->indent_size *
1547 (ctxt->level + 1 > ctxt->indent_nr ?
1548 ctxt->indent_nr : ctxt->level + 1),
1551 xmlOutputBufferWriteString(
buf,
1552 "<meta http-equiv=\"Content-Type\" "
1553 "content=\"text/html; charset=");
1554 if (ctxt->encoding) {
1555 xmlOutputBufferWriteString(
buf,
1556 (
const char *)ctxt->encoding);
1558 xmlOutputBufferWrite(
buf, 5,
"UTF-8");
1560 xmlOutputBufferWrite(
buf, 4,
"\" />");
1561 if (ctxt->format == 1)
1562 xmlOutputBufferWrite(
buf, 1,
"\n");
1564 xmlOutputBufferWrite(
buf, 1,
">");
1569 xmlOutputBufferWrite(
buf, 2,
"</");
1571 xmlOutputBufferWriteString(
buf,
1572 (
const char *)
cur->ns->prefix);
1573 xmlOutputBufferWrite(
buf, 1,
":");
1575 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1576 xmlOutputBufferWrite(
buf, 1,
">");
1579 xmlOutputBufferWrite(
buf, 1,
">");
1581 if (ctxt->format == 1) {
1582 xmlOutputBufferWrite(
buf, 1,
"\n");
1584 xmlOutputBufferWrite(
buf, ctxt->indent_size *
1585 (ctxt->level + 1 > ctxt->indent_nr ?
1586 ctxt->indent_nr : ctxt->level + 1),
1589 xmlOutputBufferWriteString(
buf,
1590 "<meta http-equiv=\"Content-Type\" "
1591 "content=\"text/html; charset=");
1592 if (ctxt->encoding) {
1593 xmlOutputBufferWriteString(
buf,
1594 (
const char *)ctxt->encoding);
1596 xmlOutputBufferWrite(
buf, 5,
"UTF-8");
1598 xmlOutputBufferWrite(
buf, 4,
"\" />");
1601 if (ctxt->format == 1) {
1602 tmp =
cur->children;
1603 while (tmp !=
NULL) {
1606 unformattedNode =
cur;
1614 if (ctxt->format == 1) xmlOutputBufferWrite(
buf, 1,
"\n");
1615 if (ctxt->level >= 0) ctxt->level++;
1627 xmlOutputBufferWriteEscape(
buf,
cur->content, ctxt->escape);
1632 xmlOutputBufferWriteString(
buf, (
const char *)
cur->content);
1638 xmlOutputBufferWrite(
buf, 2,
"<?");
1639 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1641 xmlOutputBufferWrite(
buf, 1,
" ");
1642 xmlOutputBufferWriteString(
buf,
1643 (
const char *)
cur->content);
1645 xmlOutputBufferWrite(
buf, 2,
"?>");
1647 xmlOutputBufferWrite(
buf, 2,
"<?");
1648 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1649 xmlOutputBufferWrite(
buf, 2,
"?>");
1655 xmlOutputBufferWrite(
buf, 4,
"<!--");
1656 xmlOutputBufferWriteString(
buf, (
const char *)
cur->content);
1657 xmlOutputBufferWrite(
buf, 3,
"-->");
1662 xmlOutputBufferWrite(
buf, 1,
"&");
1663 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1664 xmlOutputBufferWrite(
buf, 1,
";");
1668 if (
cur->content ==
NULL || *
cur->content ==
'\0') {
1669 xmlOutputBufferWrite(
buf, 12,
"<![CDATA[]]>");
1672 while (*
end !=
'\0') {
1673 if (*
end ==
']' && *(
end + 1) ==
']' &&
1674 *(
end + 2) ==
'>') {
1676 xmlOutputBufferWrite(
buf, 9,
"<![CDATA[");
1678 (
const char *)
start);
1679 xmlOutputBufferWrite(
buf, 3,
"]]>");
1685 xmlOutputBufferWrite(
buf, 9,
"<![CDATA[");
1686 xmlOutputBufferWriteString(
buf, (
const char *)
start);
1687 xmlOutputBufferWrite(
buf, 3,
"]]>");
1703 if (ctxt->format == 1)
1704 xmlOutputBufferWrite(
buf, 1,
"\n");
1719 if (ctxt->level > 0) ctxt->level--;
1721 xmlOutputBufferWrite(
buf, ctxt->indent_size *
1722 (ctxt->level > ctxt->indent_nr ?
1723 ctxt->indent_nr : ctxt->level),
1726 xmlOutputBufferWrite(
buf, 2,
"</");
1728 xmlOutputBufferWriteString(
buf,
1729 (
const char *)
cur->ns->prefix);
1730 xmlOutputBufferWrite(
buf, 1,
":");
1733 xmlOutputBufferWriteString(
buf, (
const char *)
cur->name);
1734 xmlOutputBufferWrite(
buf, 1,
">");
1736 if (
cur == unformattedNode) {
1738 unformattedNode =
NULL;
1770 ret->buf = xmlOutputBufferCreateFd(
fd,
ret->handler);
1773 xmlFreeSaveCtxt(
ret);
1803 xmlFreeSaveCtxt(
ret);
1828 ret->buf = xmlOutputBufferCreateBuffer(
buffer,
ret->handler);
1831 xmlFreeSaveCtxt(
ret);
1851xmlSaveToIO(xmlOutputWriteCallback iowrite,
1852 xmlOutputCloseCallback ioclose,
1859 ret->buf = xmlOutputBufferCreateIO(iowrite, ioclose, ioctx,
ret->handler);
1862 xmlFreeSaveCtxt(
ret);
1880xmlSaveDoc(xmlSaveCtxtPtr ctxt,
xmlDocPtr doc)
1884 if ((ctxt ==
NULL) || (doc ==
NULL))
return(-1);
1885 if (xmlDocContentDumpOutput(ctxt, doc) < 0)
1907#ifdef LIBXML_HTML_ENABLED
1908 if (ctxt->options & XML_SAVE_XHTML) {
1909 xhtmlNodeDumpOutput(ctxt,
cur);
1914 ((ctxt->options & XML_SAVE_AS_XML) == 0)) ||
1915 (ctxt->options & XML_SAVE_AS_HTML)) {
1916 htmlNodeDumpOutputInternal(ctxt,
cur);
1920 xmlNodeDumpOutputInternal(ctxt,
cur);
1934xmlSaveFlush(xmlSaveCtxtPtr ctxt)
1936 if (ctxt ==
NULL)
return(-1);
1937 if (ctxt->buf ==
NULL)
return(-1);
1938 return(xmlOutputBufferFlush(ctxt->buf));
1951xmlSaveClose(xmlSaveCtxtPtr ctxt)
1955 if (ctxt ==
NULL)
return(-1);
1956 ret = xmlSaveFlush(ctxt);
1957 xmlFreeSaveCtxt(ctxt);
1973 if (ctxt ==
NULL)
return(-1);
1990 if (ctxt ==
NULL)
return(-1);
1991 ctxt->escapeAttr =
escape;
2026 }
else if (*
cur ==
'\r') {
2032 }
else if (*
cur ==
'\t') {
2038 }
else if (*
cur ==
'"') {
2044 }
else if (*
cur ==
'<') {
2050 }
else if (*
cur ==
'>') {
2056 }
else if (*
cur ==
'&') {
2062 }
else if ((*
cur >= 0x80) && (
cur[1] != 0) &&
2067 unsigned char tmp[12];
2074 xmlSerializeHexCharRef(tmp, *
cur);
2079 }
else if (*
cur < 0xE0) {
2084 }
else if ((*
cur < 0xF0) && (
cur [2] != 0)) {
2091 }
else if ((*
cur < 0xF8) && (
cur [2] != 0) && (
cur[3] != 0)) {
2103 xmlSerializeHexCharRef(tmp, *
cur);
2113 xmlSerializeHexCharRef(tmp,
val);
2145 xmlBufAttrSerializeTxtContent(
buffer, doc,
attr,
string);
2214 "xmlNodeDump : node == NULL\n");
2221 "xmlNodeDump : buf == NULL\n");
2226 if (outbuf ==
NULL) {
2227 xmlSaveErrMemory(
"creating buffer");
2231 outbuf->buffer =
buf;
2232 outbuf->encoder =
NULL;
2233 outbuf->writecallback =
NULL;
2234 outbuf->closecallback =
NULL;
2235 outbuf->context =
NULL;
2236 outbuf->written = 0;
2266 "xmlElemDump : cur == NULL\n");
2273 "xmlElemDump : doc == NULL\n");
2277 outbuf = xmlOutputBufferCreateFile(
f,
NULL);
2281#ifdef LIBXML_HTML_ENABLED
2282 htmlNodeDumpOutput(outbuf, doc,
cur,
NULL);
2287 xmlNodeDumpOutput(outbuf, doc,
cur, 0, 1,
NULL);
2288 xmlOutputBufferClose(outbuf);
2315#ifdef LIBXML_HTML_ENABLED
2327 memset(&ctxt, 0,
sizeof(ctxt));
2330 ctxt.format =
format ? 1 : 0;
2332 xmlSaveCtxtInit(&ctxt);
2333 ctxt.options |= XML_SAVE_AS_XML;
2335#ifdef LIBXML_HTML_ENABLED
2344 xhtmlNodeDumpOutput(&ctxt,
cur);
2347 xmlNodeDumpOutputInternal(&ctxt,
cur);
2367 int * doc_txt_len,
const char * txt_encoding,
2374 if (doc_txt_len ==
NULL) {
2375 doc_txt_len = &
dummy;
2378 if (doc_txt_ptr ==
NULL) {
2383 *doc_txt_ptr =
NULL;
2386 if (out_doc ==
NULL) {
2396 if (txt_encoding ==
NULL)
2397 txt_encoding = (
const char *) out_doc->
encoding;
2398 if (txt_encoding !=
NULL) {
2400 if ( conv_hdlr ==
NULL ) {
2407 if ((out_buff = xmlAllocOutputBuffer(conv_hdlr)) ==
NULL ) {
2408 xmlSaveErrMemory(
"creating buffer");
2412 memset(&ctxt, 0,
sizeof(ctxt));
2413 ctxt.buf = out_buff;
2415 ctxt.format =
format ? 1 : 0;
2416 ctxt.encoding = (
const xmlChar *) txt_encoding;
2417 xmlSaveCtxtInit(&ctxt);
2418 ctxt.options |= XML_SAVE_AS_XML;
2419 xmlDocContentDumpOutput(&ctxt, out_doc);
2420 xmlOutputBufferFlush(out_buff);
2421 if (out_buff->conv !=
NULL) {
2422 *doc_txt_len =
xmlBufUse(out_buff->conv);
2425 *doc_txt_len =
xmlBufUse(out_buff->buffer);
2428 (
void)xmlOutputBufferClose(out_buff);
2430 if ((*doc_txt_ptr ==
NULL) && (*doc_txt_len > 0)) {
2432 xmlSaveErrMemory(
"creating output");
2486 int * doc_txt_len,
const char * txt_encoding) {
2487 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len,
2514 "xmlDocDump : document == NULL\n");
2530 memset(&ctxt, 0,
sizeof(ctxt));
2533 ctxt.format =
format ? 1 : 0;
2535 xmlSaveCtxtInit(&ctxt);
2536 ctxt.options |= XML_SAVE_AS_XML;
2537 xmlDocContentDumpOutput(&ctxt,
cur);
2539 ret = xmlOutputBufferClose(
buf);
2554 return(xmlDocFormatDump (
f,
cur, 0));
2576 xmlOutputBufferClose(
buf);
2579 memset(&ctxt, 0,
sizeof(ctxt));
2584 xmlSaveCtxtInit(&ctxt);
2585 ctxt.options |= XML_SAVE_AS_XML;
2586 xmlDocContentDumpOutput(&ctxt,
cur);
2587 ret = xmlOutputBufferClose(
buf);
2615 xmlOutputBufferClose(
buf);
2618 memset(&ctxt, 0,
sizeof(ctxt));
2621 ctxt.format =
format ? 1 : 0;
2623 xmlSaveCtxtInit(&ctxt);
2624 ctxt.options |= XML_SAVE_AS_XML;
2625 xmlDocContentDumpOutput(&ctxt,
cur);
2626 ret = xmlOutputBufferClose(
buf);
2664#ifdef LIBXML_ZLIB_ENABLED
2672 memset(&ctxt, 0,
sizeof(ctxt));
2675 ctxt.format =
format ? 1 : 0;
2677 xmlSaveCtxtInit(&ctxt);
2678 ctxt.options |= XML_SAVE_AS_XML;
2680 xmlDocContentDumpOutput(&ctxt,
cur);
2682 ret = xmlOutputBufferClose(
buf);
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer)
int xmlBufGetAllocationScheme(xmlBufPtr buf)
void xmlBufFree(xmlBufPtr buf)
xmlBufPtr xmlBufCreate(void)
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer)
int xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme)
int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string)
xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf)
int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len)
static const WCHAR indent[]
UINT(* handler)(MSIPACKAGE *)
int xmlCharEncOutput(xmlOutputBufferPtr output, int init)
XMLPUBFUN int XMLCALL xmlCharEncCloseFunc(xmlCharEncodingHandler *handler)
int(* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, const unsigned char *in, int *inlen)
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
@ XML_CHAR_ENCODING_ASCII
XMLPUBFUN xmlCharEncoding XMLCALL xmlParseCharEncoding(const char *name)
GLuint GLuint GLsizei GLenum type
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)
XMLPUBVAR const xmlChar xmlStringTextNoenc[]
XMLPUBVAR const xmlChar xmlStringText[]
XMLPUBVAR int xmlSaveNoEmptyTags
XMLPUBVAR xmlMallocFunc xmlMalloc
XMLPUBVAR int xmlIndentTreeOutput
XMLPUBVAR const char * xmlTreeIndentString
XMLPUBVAR xmlFreeFunc xmlFree
XMLPUBVAR void * xmlGenericErrorContext
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
XMLPUBFUN void XMLCALL xmlInitParser(void)
XMLPUBFUN xmlChar *XMLCALL xmlGetProp(const xmlNode *node, const xmlChar *name)
xmlOutputBuffer * xmlOutputBufferPtr
XMLPUBFUN size_t XMLCALL xmlBufUse(const xmlBufPtr buf)
struct _xmlOutputBuffer xmlOutputBuffer
XMLPUBFUN xmlDtdPtr XMLCALL xmlGetIntSubset(const xmlDoc *doc)
XMLPUBFUN int XMLCALL xmlGetCompressMode(void)
XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreate(void)
@ XML_BUFFER_ALLOC_DOUBLEIT
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocText(const xmlDoc *doc, const xmlChar *content)
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
XMLPUBFUN void XMLCALL xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferAllocationScheme scheme)
XMLPUBFUN xmlChar *XMLCALL xmlBufContent(const xmlBuf *buf)
#define XML_LOCAL_NAMESPACE
struct _xmlNode * children
const xmlChar * ExternalID
static const WCHAR lang[]
@ XML_SAVE_UNKNOWN_ENCODING
#define XHTML_TRANS_PUBLIC_ID
#define XHTML_FRAME_SYSTEM_ID
#define XHTML_STRICT_SYSTEM_ID
#define XHTML_FRAME_PUBLIC_ID
#define XHTML_TRANS_SYSTEM_ID
#define XHTML_STRICT_PUBLIC_ID
int xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID)
XMLPUBFUN xmlChar *XMLCALL xmlStrndup(const xmlChar *cur, int len)
XMLPUBFUN int XMLCALL xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2)
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)