* htmlReadIO: * @ioread: an I/O read function * @ioclose: an I/O close function * @ioctx: an I/O handler * @URL: the base URL to use for the document * @encoding: the document encoding, or NULL * @options: a combination of htmlParserOption(s) * * parse an HTML document from I/O functions and source and build a tree. * * Returns the resulting document tree */
| 6106 | * Returns the resulting document tree |
| 6107 | */ |
| 6108 | htmlDocPtr |
| 6109 | htmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, |
| 6110 | void *ioctx, const char *URL, const char *encoding, int options) |
| 6111 | { |
| 6112 | htmlParserCtxtPtr ctxt; |
| 6113 | xmlParserInputBufferPtr input; |
| 6114 | xmlParserInputPtr stream; |
| 6115 | |
| 6116 | if (ioread == NULL) |
| 6117 | return (NULL); |
| 6118 | xmlInitParser(); |
| 6119 | |
| 6120 | input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, |
| 6121 | XML_CHAR_ENCODING_NONE); |
| 6122 | if (input == NULL) |
| 6123 | return (NULL); |
| 6124 | ctxt = htmlNewParserCtxt(); |
| 6125 | if (ctxt == NULL) { |
| 6126 | xmlFreeParserInputBuffer(input); |
| 6127 | return (NULL); |
| 6128 | } |
| 6129 | stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); |
| 6130 | if (stream == NULL) { |
| 6131 | xmlFreeParserInputBuffer(input); |
| 6132 | xmlFreeParserCtxt(ctxt); |
| 6133 | return (NULL); |
| 6134 | } |
| 6135 | inputPush(ctxt, stream); |
| 6136 | return (htmlDoRead(ctxt, URL, encoding, options, 0)); |
| 6137 | } |
| 6138 | |
| 6139 | /** |
| 6140 | * htmlCtxtReadDoc: |
nothing calls this directly
no test coverage detected