* xmlNewInputFd: * @ctxt: parser context * @url: base URL (optional) * @fd: file descriptor * @encoding: character encoding (optional) * @flags: unused, pass 0 * * Creates a new parser input to read from a zero-terminated string. * * @url is used as base to resolve external entities and for * error reporting. * * @fd is closed after parsing has finished. * * Returns a new parser
| 1714 | * Returns a new parser input. |
| 1715 | */ |
| 1716 | xmlParserInputPtr |
| 1717 | xmlNewInputFd(xmlParserCtxtPtr ctxt, const char *url, |
| 1718 | int fd, const char *encoding, int flags ATTRIBUTE_UNUSED) { |
| 1719 | xmlParserInputBufferPtr buf; |
| 1720 | |
| 1721 | if ((ctxt == NULL) || (fd < 0)) |
| 1722 | return(NULL); |
| 1723 | |
| 1724 | buf = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); |
| 1725 | if (buf == NULL) { |
| 1726 | xmlCtxtErrMemory(ctxt); |
| 1727 | return(NULL); |
| 1728 | } |
| 1729 | |
| 1730 | return(xmlNewInputInternal(ctxt, buf, url, encoding)); |
| 1731 | } |
| 1732 | |
| 1733 | /** |
| 1734 | * xmlNewInputIO: |
no test coverage detected