* xmlSaveToFd: * @fd: a file descriptor number * @encoding: the encoding name to use or NULL * @options: a set of xmlSaveOptions * * Create a document saving context serializing to a file descriptor * with the encoding and the options given. * * Returns a new serialization context or NULL in case of error. */
| 2004 | * Returns a new serialization context or NULL in case of error. |
| 2005 | */ |
| 2006 | xmlSaveCtxtPtr |
| 2007 | xmlSaveToFd(int fd, const char *encoding, int options) |
| 2008 | { |
| 2009 | xmlSaveCtxtPtr ret; |
| 2010 | |
| 2011 | ret = xmlNewSaveCtxt(encoding, options); |
| 2012 | if (ret == NULL) return(NULL); |
| 2013 | ret->buf = xmlOutputBufferCreateFd(fd, ret->handler); |
| 2014 | if (ret->buf == NULL) { |
| 2015 | xmlCharEncCloseFunc(ret->handler); |
| 2016 | xmlFreeSaveCtxt(ret); |
| 2017 | return(NULL); |
| 2018 | } |
| 2019 | return(ret); |
| 2020 | } |
| 2021 | |
| 2022 | /** |
| 2023 | * xmlSaveToFilename: |
no test coverage detected