* htmlReadMemory: * @buffer: a pointer to a char array * @size: the size of the array * @url: only used for error reporting (optional) * @encoding: the document encoding, or NULL * @options: a combination of htmlParserOption(s) * * Convenience function to parse an HTML document from memory. * The input buffer must not contain any terminating null bytes. * * See htmlCtxtReadMemory fo
| 6438 | * Returns the resulting document tree |
| 6439 | */ |
| 6440 | htmlDocPtr |
| 6441 | htmlReadMemory(const char *buffer, int size, const char *url, |
| 6442 | const char *encoding, int options) |
| 6443 | { |
| 6444 | htmlParserCtxtPtr ctxt; |
| 6445 | xmlParserInputPtr input; |
| 6446 | htmlDocPtr doc; |
| 6447 | |
| 6448 | if (size < 0) |
| 6449 | return(NULL); |
| 6450 | |
| 6451 | ctxt = htmlNewParserCtxt(); |
| 6452 | if (ctxt == NULL) |
| 6453 | return(NULL); |
| 6454 | |
| 6455 | htmlCtxtUseOptions(ctxt, options); |
| 6456 | |
| 6457 | input = xmlNewInputMemory(ctxt, url, buffer, size, encoding, |
| 6458 | XML_INPUT_BUF_STATIC); |
| 6459 | |
| 6460 | doc = htmlCtxtParseDocument(ctxt, input); |
| 6461 | |
| 6462 | htmlFreeParserCtxt(ctxt); |
| 6463 | return(doc); |
| 6464 | } |
| 6465 | |
| 6466 | /** |
| 6467 | * htmlReadFd: |
no test coverage detected