MCPcopy Create free account
hub / github.com/Kitware/VTK / htmlSaveFileFormat

Function htmlSaveFileFormat

ThirdParty/libxml2/vtklibxml2/HTMLtree.c:1088–1119  ·  view source on GitHub ↗

* htmlSaveFileFormat: * @filename: the filename * @cur: the document * @format: should formatting spaces been added * @encoding: the document encoding * * Dump an HTML document to a file using a given encoding. * * returns: the number of byte written or -1 in case of failure. */

Source from the content-addressed store, hash-verified

1086 * returns: the number of byte written or -1 in case of failure.
1087 */
1088int
1089htmlSaveFileFormat(const char *filename, xmlDocPtr cur,
1090 const char *encoding, int format) {
1091 xmlOutputBufferPtr buf;
1092 xmlCharEncodingHandlerPtr handler = NULL;
1093 int ret;
1094
1095 if ((cur == NULL) || (filename == NULL))
1096 return(-1);
1097
1098 xmlInitParser();
1099
1100 handler = htmlFindOutputEncoder(encoding);
1101 if (handler != NULL)
1102 htmlSetMetaEncoding(cur, (const xmlChar *) handler->name);
1103 else
1104 htmlSetMetaEncoding(cur, (const xmlChar *) "UTF-8");
1105
1106 /*
1107 * save the content to a temp buffer.
1108 */
1109 buf = xmlOutputBufferCreateFilename(filename, handler, 0);
1110 if (buf == NULL) {
1111 xmlCharEncCloseFunc(handler);
1112 return(0);
1113 }
1114
1115 htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
1116
1117 ret = xmlOutputBufferClose(buf);
1118 return(ret);
1119}
1120
1121/**
1122 * htmlSaveFileEnc:

Callers 2

parseAndPrintFileFunction · 0.85
htmlSaveFileEncFunction · 0.85

Calls 7

xmlInitParserFunction · 0.85
htmlFindOutputEncoderFunction · 0.85
htmlSetMetaEncodingFunction · 0.85
xmlCharEncCloseFuncFunction · 0.85
xmlOutputBufferCloseFunction · 0.85

Tested by

no test coverage detected