* htmlReadDoc: * @str: a pointer to a zero terminated string * @url: only used for error reporting (optoinal) * @encoding: the document encoding (optional) * @options: a combination of htmlParserOptions * * Convenience function to parse an HTML document from a zero-terminated * string. * * See htmlCtxtReadDoc for details. * * Returns the resulting document tree. */
| 6366 | * Returns the resulting document tree. |
| 6367 | */ |
| 6368 | htmlDocPtr |
| 6369 | htmlReadDoc(const xmlChar *str, const char *url, const char *encoding, |
| 6370 | int options) |
| 6371 | { |
| 6372 | htmlParserCtxtPtr ctxt; |
| 6373 | xmlParserInputPtr input; |
| 6374 | htmlDocPtr doc; |
| 6375 | |
| 6376 | ctxt = htmlNewParserCtxt(); |
| 6377 | if (ctxt == NULL) |
| 6378 | return(NULL); |
| 6379 | |
| 6380 | htmlCtxtUseOptions(ctxt, options); |
| 6381 | |
| 6382 | input = xmlNewInputString(ctxt, url, (const char *) str, encoding, |
| 6383 | XML_INPUT_BUF_STATIC); |
| 6384 | |
| 6385 | doc = htmlCtxtParseDocument(ctxt, input); |
| 6386 | |
| 6387 | htmlFreeParserCtxt(ctxt); |
| 6388 | return(doc); |
| 6389 | } |
| 6390 | |
| 6391 | /** |
| 6392 | * htmlReadFile: |
nothing calls this directly
no test coverage detected