* htmlCtxtReadMemory: * @ctxt: an HTML parser context * @buffer: a pointer to a char array * @size: the size of the array * @URL: the base URL to use for the document * @encoding: the document encoding, or NULL * @options: a combination of htmlParserOption(s) * * parse an XML in-memory document and build a tree. * This reuses the existing @ctxt parser context * * Returns the resu
| 6218 | * Returns the resulting document tree |
| 6219 | */ |
| 6220 | htmlDocPtr |
| 6221 | htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size, |
| 6222 | const char *URL, const char *encoding, int options) |
| 6223 | { |
| 6224 | xmlParserInputBufferPtr input; |
| 6225 | xmlParserInputPtr stream; |
| 6226 | |
| 6227 | if (ctxt == NULL) |
| 6228 | return (NULL); |
| 6229 | if (buffer == NULL) |
| 6230 | return (NULL); |
| 6231 | |
| 6232 | htmlCtxtReset(ctxt); |
| 6233 | |
| 6234 | input = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE); |
| 6235 | if (input == NULL) { |
| 6236 | return(NULL); |
| 6237 | } |
| 6238 | |
| 6239 | stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); |
| 6240 | if (stream == NULL) { |
| 6241 | xmlFreeParserInputBuffer(input); |
| 6242 | return(NULL); |
| 6243 | } |
| 6244 | |
| 6245 | inputPush(ctxt, stream); |
| 6246 | return (htmlDoRead(ctxt, URL, encoding, options, 1)); |
| 6247 | } |
| 6248 | |
| 6249 | /** |
| 6250 | * htmlCtxtReadFd: |