* htmlCreateDocParserCtxt: * @str: a pointer to an array of xmlChar * @encoding: encoding (optional) * * Create a parser context for a null-terminated string. * * Returns the new parser context or NULL if a memory allocation failed. */
| 5073 | * Returns the new parser context or NULL if a memory allocation failed. |
| 5074 | */ |
| 5075 | static htmlParserCtxtPtr |
| 5076 | htmlCreateDocParserCtxt(const xmlChar *str, const char *url, |
| 5077 | const char *encoding) { |
| 5078 | xmlParserCtxtPtr ctxt; |
| 5079 | xmlParserInputPtr input; |
| 5080 | |
| 5081 | if (str == NULL) |
| 5082 | return(NULL); |
| 5083 | |
| 5084 | ctxt = htmlNewParserCtxt(); |
| 5085 | if (ctxt == NULL) |
| 5086 | return(NULL); |
| 5087 | |
| 5088 | input = xmlNewInputString(ctxt, url, (const char *) str, encoding, 0); |
| 5089 | if (input == NULL) { |
| 5090 | xmlFreeParserCtxt(ctxt); |
| 5091 | return(NULL); |
| 5092 | } |
| 5093 | |
| 5094 | inputPush(ctxt, input); |
| 5095 | |
| 5096 | return(ctxt); |
| 5097 | } |
| 5098 | |
| 5099 | #ifdef LIBXML_PUSH_ENABLED |
| 5100 | /************************************************************************ |
no test coverage detected