Lines Matching +full:- +full:- +full:output +full:- +full:document

43  * @doc:  the document
57 cur = doc->children; in htmlGetMetaEncoding()
63 if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { in htmlGetMetaEncoding()
64 if (xmlStrEqual(cur->name, BAD_CAST"html")) in htmlGetMetaEncoding()
66 if (xmlStrEqual(cur->name, BAD_CAST"head")) in htmlGetMetaEncoding()
68 if (xmlStrEqual(cur->name, BAD_CAST"meta")) in htmlGetMetaEncoding()
71 cur = cur->next; in htmlGetMetaEncoding()
75 cur = cur->children; in htmlGetMetaEncoding()
81 if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { in htmlGetMetaEncoding()
82 if (xmlStrEqual(cur->name, BAD_CAST"head")) in htmlGetMetaEncoding()
84 if (xmlStrEqual(cur->name, BAD_CAST"meta")) in htmlGetMetaEncoding()
87 cur = cur->next; in htmlGetMetaEncoding()
92 cur = cur->children; in htmlGetMetaEncoding()
99 if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { in htmlGetMetaEncoding()
100 if (xmlStrEqual(cur->name, BAD_CAST"meta")) { in htmlGetMetaEncoding()
101 xmlAttrPtr attr = cur->properties; in htmlGetMetaEncoding()
108 if ((attr->children != NULL) && in htmlGetMetaEncoding()
109 (attr->children->type == XML_TEXT_NODE) && in htmlGetMetaEncoding()
110 (attr->children->next == NULL)) { in htmlGetMetaEncoding()
111 value = attr->children->content; in htmlGetMetaEncoding()
112 if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv")) in htmlGetMetaEncoding()
113 && (!xmlStrcasecmp(value, BAD_CAST"Content-Type"))) in htmlGetMetaEncoding()
116 && (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) in htmlGetMetaEncoding()
121 attr = attr->next; in htmlGetMetaEncoding()
125 cur = cur->next; in htmlGetMetaEncoding()
154 * @doc: the document
158 * NOTE: this will not change the document content encoding, just
161 * Returns 0 in case of success and -1 in case of error
172 return(-1); in htmlSetMetaEncoding()
176 return(-1); in htmlSetMetaEncoding()
181 newcontent[sizeof(newcontent) - 1] = 0; in htmlSetMetaEncoding()
184 cur = doc->children; in htmlSetMetaEncoding()
190 if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { in htmlSetMetaEncoding()
191 if (xmlStrcasecmp(cur->name, BAD_CAST"html") == 0) in htmlSetMetaEncoding()
193 if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) in htmlSetMetaEncoding()
195 if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) in htmlSetMetaEncoding()
198 cur = cur->next; in htmlSetMetaEncoding()
201 return(-1); in htmlSetMetaEncoding()
202 cur = cur->children; in htmlSetMetaEncoding()
208 if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { in htmlSetMetaEncoding()
209 if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) in htmlSetMetaEncoding()
211 if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) { in htmlSetMetaEncoding()
212 head = cur->parent; in htmlSetMetaEncoding()
216 cur = cur->next; in htmlSetMetaEncoding()
219 return(-1); in htmlSetMetaEncoding()
222 if (cur->children == NULL) in htmlSetMetaEncoding()
224 cur = cur->children; in htmlSetMetaEncoding()
232 if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { in htmlSetMetaEncoding()
233 if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) { in htmlSetMetaEncoding()
234 xmlAttrPtr attr = cur->properties; in htmlSetMetaEncoding()
241 if ((attr->children != NULL) && in htmlSetMetaEncoding()
242 (attr->children->type == XML_TEXT_NODE) && in htmlSetMetaEncoding()
243 (attr->children->next == NULL)) { in htmlSetMetaEncoding()
244 value = attr->children->content; in htmlSetMetaEncoding()
245 if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv")) in htmlSetMetaEncoding()
246 && (!xmlStrcasecmp(value, BAD_CAST"Content-Type"))) in htmlSetMetaEncoding()
251 (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) in htmlSetMetaEncoding()
257 attr = attr->next; in htmlSetMetaEncoding()
266 cur = cur->next; in htmlSetMetaEncoding()
276 if (head->children == NULL) in htmlSetMetaEncoding()
279 xmlAddPrevSibling(head->children, meta); in htmlSetMetaEncoding()
280 xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); in htmlSetMetaEncoding()
289 /* change the document only if there is a real encoding change */ in htmlSetMetaEncoding()
302 * These are the HTML attributes which will be output
304 * output as <option selected>, as per XSLT 1.0 16.2 "HTML Output Method"
343 * Output error handlers *
373 msg = "string is not in UTF-8\n"; in htmlSaveErr()
398 * @buf: the xmlBufPtr output
399 * @doc: the document
405 * Returns the number of byte written or -1 in case of error
415 return (-1); in htmlBufNodeDumpFormat()
418 return (-1); in htmlBufNodeDumpFormat()
422 htmlSaveErrMemory("allocating HTML output buffer"); in htmlBufNodeDumpFormat()
423 return (-1); in htmlBufNodeDumpFormat()
426 outbuf->buffer = buf; in htmlBufNodeDumpFormat()
427 outbuf->encoder = NULL; in htmlBufNodeDumpFormat()
428 outbuf->writecallback = NULL; in htmlBufNodeDumpFormat()
429 outbuf->closecallback = NULL; in htmlBufNodeDumpFormat()
430 outbuf->context = NULL; in htmlBufNodeDumpFormat()
431 outbuf->written = 0; in htmlBufNodeDumpFormat()
436 ret = xmlBufUse(buf) - use; in htmlBufNodeDumpFormat()
442 * @buf: the HTML buffer output
443 * @doc: the document
449 * Returns the number of byte written or -1 in case of error
457 return(-1); in htmlNodeDump()
462 return(-1); in htmlNodeDump()
469 return(-1); in htmlNodeDump()
476 * @doc: the document
478 * @encoding: the document encoding
485 * returns: the number of byte written or -1 in case of failure.
530 * @doc: the document
543 * @cur: the document
548 * Dump an HTML document in memory and return the xmlChar * and it's size.
599 if (buf->conv != NULL) { in htmlDocDumpMemoryFormat()
600 *size = xmlBufUse(buf->conv); in htmlDocDumpMemoryFormat()
601 *mem = xmlStrndup(xmlBufContent(buf->conv), *size); in htmlDocDumpMemoryFormat()
603 *size = xmlBufUse(buf->buffer); in htmlDocDumpMemoryFormat()
604 *mem = xmlStrndup(xmlBufContent(buf->buffer), *size); in htmlDocDumpMemoryFormat()
611 * @cur: the document
615 * Dump an HTML document in memory and return the xmlChar * and it's size.
626 * Dumping HTML tree content to an I/O output buffer *
634 * @buf: the HTML buffer output
635 * @doc: the document
640 * Dump the HTML document DTD, if any.
645 xmlDtdPtr cur = doc->intSubset; in htmlDtdDumpOutput()
652 xmlOutputBufferWriteString(buf, (const char *)cur->name); in htmlDtdDumpOutput()
653 if (cur->ExternalID != NULL) { in htmlDtdDumpOutput()
655 xmlBufWriteQuotedString(buf->buffer, cur->ExternalID); in htmlDtdDumpOutput()
656 if (cur->SystemID != NULL) { in htmlDtdDumpOutput()
658 xmlBufWriteQuotedString(buf->buffer, cur->SystemID); in htmlDtdDumpOutput()
660 } else if (cur->SystemID != NULL && in htmlDtdDumpOutput()
661 xmlStrcmp(cur->SystemID, BAD_CAST "about:legacy-compat")) { in htmlDtdDumpOutput()
663 xmlBufWriteQuotedString(buf->buffer, cur->SystemID); in htmlDtdDumpOutput()
670 * @buf: the HTML buffer output
671 * @doc: the document
681 * The html output method should not escape a & character in htmlAttrDumpOutput()
691 if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { in htmlAttrDumpOutput()
692 xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); in htmlAttrDumpOutput()
695 xmlOutputBufferWriteString(buf, (const char *)cur->name); in htmlAttrDumpOutput()
696 if ((cur->children != NULL) && (!htmlIsBooleanAttr(cur->name))) { in htmlAttrDumpOutput()
697 value = xmlNodeListGetString(doc, cur->children, 0); in htmlAttrDumpOutput()
700 if ((cur->ns == NULL) && (cur->parent != NULL) && in htmlAttrDumpOutput()
701 (cur->parent->ns == NULL) && in htmlAttrDumpOutput()
702 ((!xmlStrcasecmp(cur->name, BAD_CAST "href")) || in htmlAttrDumpOutput()
703 (!xmlStrcasecmp(cur->name, BAD_CAST "action")) || in htmlAttrDumpOutput()
704 (!xmlStrcasecmp(cur->name, BAD_CAST "src")) || in htmlAttrDumpOutput()
705 ((!xmlStrcasecmp(cur->name, BAD_CAST "name")) && in htmlAttrDumpOutput()
706 (!xmlStrcasecmp(cur->parent->name, BAD_CAST "a"))))) { in htmlAttrDumpOutput()
718 xmlBufWriteQuotedString(buf->buffer, escaped); in htmlAttrDumpOutput()
721 xmlBufWriteQuotedString(buf->buffer, value); in htmlAttrDumpOutput()
724 xmlBufWriteQuotedString(buf->buffer, value); in htmlAttrDumpOutput()
735 * @buf: the HTML buffer output
736 * @doc: the document
759 switch (cur->type) { in htmlNodeDumpFormatOutput()
762 if (((xmlDocPtr) cur)->intSubset != NULL) { in htmlNodeDumpFormatOutput()
765 if (cur->children != NULL) { in htmlNodeDumpFormatOutput()
766 cur = cur->children; in htmlNodeDumpFormatOutput()
775 if (cur->ns == NULL) in htmlNodeDumpFormatOutput()
776 info = htmlTagLookup(cur->name); in htmlNodeDumpFormatOutput()
781 if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { in htmlNodeDumpFormatOutput()
782 xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); in htmlNodeDumpFormatOutput()
785 xmlOutputBufferWriteString(buf, (const char *)cur->name); in htmlNodeDumpFormatOutput()
786 if (cur->nsDef) in htmlNodeDumpFormatOutput()
787 xmlNsListDumpOutput(buf, cur->nsDef); in htmlNodeDumpFormatOutput()
788 attr = cur->properties; in htmlNodeDumpFormatOutput()
791 attr = attr->next; in htmlNodeDumpFormatOutput()
794 if ((info != NULL) && (info->empty)) { in htmlNodeDumpFormatOutput()
796 } else if (cur->children == NULL) { in htmlNodeDumpFormatOutput()
797 if ((info != NULL) && (info->saveEndTag != 0) && in htmlNodeDumpFormatOutput()
798 (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) && in htmlNodeDumpFormatOutput()
799 (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) { in htmlNodeDumpFormatOutput()
803 if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { in htmlNodeDumpFormatOutput()
805 (const char *)cur->ns->prefix); in htmlNodeDumpFormatOutput()
808 xmlOutputBufferWriteString(buf, (const char *)cur->name); in htmlNodeDumpFormatOutput()
813 if ((format) && (info != NULL) && (!info->isinline) && in htmlNodeDumpFormatOutput()
814 (cur->children->type != HTML_TEXT_NODE) && in htmlNodeDumpFormatOutput()
815 (cur->children->type != HTML_ENTITY_REF_NODE) && in htmlNodeDumpFormatOutput()
816 (cur->children != cur->last) && in htmlNodeDumpFormatOutput()
817 (cur->name != NULL) && in htmlNodeDumpFormatOutput()
818 (cur->name[0] != 'p')) /* p, pre, param */ in htmlNodeDumpFormatOutput()
820 cur = cur->children; in htmlNodeDumpFormatOutput()
824 if ((format) && (cur->next != NULL) && in htmlNodeDumpFormatOutput()
825 (info != NULL) && (!info->isinline)) { in htmlNodeDumpFormatOutput()
826 if ((cur->next->type != HTML_TEXT_NODE) && in htmlNodeDumpFormatOutput()
827 (cur->next->type != HTML_ENTITY_REF_NODE) && in htmlNodeDumpFormatOutput()
828 (cur->parent != NULL) && in htmlNodeDumpFormatOutput()
829 (cur->parent->name != NULL) && in htmlNodeDumpFormatOutput()
830 (cur->parent->name[0] != 'p')) /* p, pre, param */ in htmlNodeDumpFormatOutput()
841 if (cur->content == NULL) in htmlNodeDumpFormatOutput()
843 if (((cur->name == (const xmlChar *)xmlStringText) || in htmlNodeDumpFormatOutput()
844 (cur->name != (const xmlChar *)xmlStringTextNoenc)) && in htmlNodeDumpFormatOutput()
845 ((cur->parent == NULL) || in htmlNodeDumpFormatOutput()
846 ((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) && in htmlNodeDumpFormatOutput()
847 (xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) { in htmlNodeDumpFormatOutput()
850 buffer = xmlEncodeEntitiesReentrant(doc, cur->content); in htmlNodeDumpFormatOutput()
856 xmlOutputBufferWriteString(buf, (const char *)cur->content); in htmlNodeDumpFormatOutput()
861 if (cur->content != NULL) { in htmlNodeDumpFormatOutput()
862 xmlOutputBufferWriteString(buf, "<!--"); in htmlNodeDumpFormatOutput()
863 xmlOutputBufferWriteString(buf, (const char *)cur->content); in htmlNodeDumpFormatOutput()
864 xmlOutputBufferWriteString(buf, "-->"); in htmlNodeDumpFormatOutput()
869 if (cur->name != NULL) { in htmlNodeDumpFormatOutput()
871 xmlOutputBufferWriteString(buf, (const char *)cur->name); in htmlNodeDumpFormatOutput()
872 if (cur->content != NULL) { in htmlNodeDumpFormatOutput()
875 (const char *)cur->content); in htmlNodeDumpFormatOutput()
883 xmlOutputBufferWriteString(buf, (const char *)cur->name); in htmlNodeDumpFormatOutput()
888 if (cur->content != NULL) { in htmlNodeDumpFormatOutput()
889 xmlOutputBufferWriteString(buf, (const char *)cur->content); in htmlNodeDumpFormatOutput()
900 if (cur->next != NULL) { in htmlNodeDumpFormatOutput()
901 cur = cur->next; in htmlNodeDumpFormatOutput()
909 if (cur->parent == NULL) in htmlNodeDumpFormatOutput()
911 cur = cur->parent; in htmlNodeDumpFormatOutput()
913 if ((cur->type == XML_HTML_DOCUMENT_NODE) || in htmlNodeDumpFormatOutput()
914 (cur->type == XML_DOCUMENT_NODE)) { in htmlNodeDumpFormatOutput()
917 if ((format) && (cur->ns == NULL)) in htmlNodeDumpFormatOutput()
918 info = htmlTagLookup(cur->name); in htmlNodeDumpFormatOutput()
922 if ((format) && (info != NULL) && (!info->isinline) && in htmlNodeDumpFormatOutput()
923 (cur->last->type != HTML_TEXT_NODE) && in htmlNodeDumpFormatOutput()
924 (cur->last->type != HTML_ENTITY_REF_NODE) && in htmlNodeDumpFormatOutput()
925 (cur->children != cur->last) && in htmlNodeDumpFormatOutput()
926 (cur->name != NULL) && in htmlNodeDumpFormatOutput()
927 (cur->name[0] != 'p')) /* p, pre, param */ in htmlNodeDumpFormatOutput()
931 if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { in htmlNodeDumpFormatOutput()
932 xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); in htmlNodeDumpFormatOutput()
935 xmlOutputBufferWriteString(buf, (const char *)cur->name); in htmlNodeDumpFormatOutput()
938 if ((format) && (info != NULL) && (!info->isinline) && in htmlNodeDumpFormatOutput()
939 (cur->next != NULL)) { in htmlNodeDumpFormatOutput()
940 if ((cur->next->type != HTML_TEXT_NODE) && in htmlNodeDumpFormatOutput()
941 (cur->next->type != HTML_ENTITY_REF_NODE) && in htmlNodeDumpFormatOutput()
942 (cur->parent != NULL) && in htmlNodeDumpFormatOutput()
943 (cur->parent->name != NULL) && in htmlNodeDumpFormatOutput()
944 (cur->parent->name[0] != 'p')) /* p, pre, param */ in htmlNodeDumpFormatOutput()
954 * @buf: the HTML buffer output
955 * @doc: the document
970 * @buf: the HTML buffer output
971 * @cur: the document
975 * Dump an HTML document.
986 * @buf: the HTML buffer output
987 * @cur: the document
990 * Dump an HTML document. Formatting return/spaces are added.
1000 * Saving functions front-ends *
1007 * @cur: the document
1009 * Dump an HTML document to an open FILE.
1011 * returns: the number of byte written or -1 in case of failure.
1023 return(-1); in htmlDocDump()
1048 if (buf == NULL) return(-1); in htmlDocDump()
1058 * @cur: the document
1060 * Dump an HTML document to a file. If @filename is "-" the stdout file is
1062 * returns: the number of byte written or -1 in case of failure.
1072 return(-1); in htmlSaveFile()
1100 buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression); in htmlSaveFile()
1112 * @cur: the document
1114 * @encoding: the document encoding
1116 * Dump an HTML document to a file using a given encoding.
1118 * returns: the number of byte written or -1 in case of failure.
1128 return(-1); in htmlSaveFileFormat()
1143 htmlSetMetaEncoding(cur, (const xmlChar *) "UTF-8"); in htmlSaveFileFormat()
1169 * @cur: the document
1170 * @encoding: the document encoding
1172 * Dump an HTML document to a file using a given encoding
1175 * returns: the number of byte written or -1 in case of failure.