* htmlDocDump: * @f: the FILE* * @cur: the document * * Dump an HTML document to an open FILE. * * returns: the number of byte written or -1 in case of failure. */
| 1014 | * returns: the number of byte written or -1 in case of failure. |
| 1015 | */ |
| 1016 | int |
| 1017 | htmlDocDump(FILE *f, xmlDocPtr cur) { |
| 1018 | xmlOutputBufferPtr buf; |
| 1019 | xmlCharEncodingHandlerPtr handler = NULL; |
| 1020 | const char *encoding; |
| 1021 | int ret; |
| 1022 | |
| 1023 | xmlInitParser(); |
| 1024 | |
| 1025 | if ((cur == NULL) || (f == NULL)) { |
| 1026 | return(-1); |
| 1027 | } |
| 1028 | |
| 1029 | encoding = (const char *) htmlGetMetaEncoding(cur); |
| 1030 | handler = htmlFindOutputEncoder(encoding); |
| 1031 | buf = xmlOutputBufferCreateFile(f, handler); |
| 1032 | if (buf == NULL) { |
| 1033 | xmlCharEncCloseFunc(handler); |
| 1034 | return(-1); |
| 1035 | } |
| 1036 | htmlDocContentDumpOutput(buf, cur, NULL); |
| 1037 | |
| 1038 | ret = xmlOutputBufferClose(buf); |
| 1039 | return(ret); |
| 1040 | } |
| 1041 | |
| 1042 | /** |
| 1043 | * htmlSaveFile: |
no test coverage detected