* xmlNewInputIO: * @ctxt: parser context * @url: base URL (optional) * @ioRead: read callback * @ioClose: close callback (optional) * @ioCtxt: IO context * @encoding: character encoding (optional) * @flags: unused, pass 0 * * Creates a new parser input to read from input callbacks and * cintext. * * @url is used as base to resolve external entities and for * error reporting. *
| 1757 | * Returns a new parser input. |
| 1758 | */ |
| 1759 | xmlParserInputPtr |
| 1760 | xmlNewInputIO(xmlParserCtxtPtr ctxt, const char *url, |
| 1761 | xmlInputReadCallback ioRead, xmlInputCloseCallback ioClose, |
| 1762 | void *ioCtxt, |
| 1763 | const char *encoding, int flags ATTRIBUTE_UNUSED) { |
| 1764 | xmlParserInputBufferPtr buf; |
| 1765 | |
| 1766 | if ((ctxt == NULL) || (ioRead == NULL)) |
| 1767 | return(NULL); |
| 1768 | |
| 1769 | buf = xmlAllocParserInputBuffer(XML_CHAR_ENCODING_NONE); |
| 1770 | if (buf == NULL) { |
| 1771 | xmlCtxtErrMemory(ctxt); |
| 1772 | if (ioClose != NULL) |
| 1773 | ioClose(ioCtxt); |
| 1774 | return(NULL); |
| 1775 | } |
| 1776 | |
| 1777 | buf->context = ioCtxt; |
| 1778 | buf->readcallback = ioRead; |
| 1779 | buf->closecallback = ioClose; |
| 1780 | |
| 1781 | return(xmlNewInputInternal(ctxt, buf, url, encoding)); |
| 1782 | } |
| 1783 | |
| 1784 | /** |
| 1785 | * xmlNewInputPush: |
no test coverage detected