* xmlSaveToFilename: * @filename: a file name or an URL * @encoding: the encoding name to use or NULL * @options: a set of xmlSaveOptions * * Create a document saving context serializing to a filename or possibly * to an URL (but this is less reliable) with the encoding and the options * given. * * Returns a new serialization context or NULL in case of error. */
| 2032 | * Returns a new serialization context or NULL in case of error. |
| 2033 | */ |
| 2034 | xmlSaveCtxtPtr |
| 2035 | xmlSaveToFilename(const char *filename, const char *encoding, int options) |
| 2036 | { |
| 2037 | xmlSaveCtxtPtr ret; |
| 2038 | int compression = 0; /* TODO handle compression option */ |
| 2039 | |
| 2040 | ret = xmlNewSaveCtxt(encoding, options); |
| 2041 | if (ret == NULL) return(NULL); |
| 2042 | ret->buf = xmlOutputBufferCreateFilename(filename, ret->handler, |
| 2043 | compression); |
| 2044 | if (ret->buf == NULL) { |
| 2045 | xmlCharEncCloseFunc(ret->handler); |
| 2046 | xmlFreeSaveCtxt(ret); |
| 2047 | return(NULL); |
| 2048 | } |
| 2049 | return(ret); |
| 2050 | } |
| 2051 | |
| 2052 | /** |
| 2053 | * xmlSaveToBuffer: |
no test coverage detected