* htmlCreatePushParserCtxt: * @sax: a SAX handler (optional) * @user_data: The user data returned on SAX callbacks (optional) * @chunk: a pointer to an array of chars (optional) * @size: number of chars in the array * @filename: only used for error reporting (optional) * @enc: encoding (deprecated, pass XML_CHAR_ENCODING_NONE) * * Create a parser context for using the HTML parser in
| 5802 | * failed. |
| 5803 | */ |
| 5804 | htmlParserCtxtPtr |
| 5805 | htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, |
| 5806 | const char *chunk, int size, const char *filename, |
| 5807 | xmlCharEncoding enc) { |
| 5808 | htmlParserCtxtPtr ctxt; |
| 5809 | htmlParserInputPtr input; |
| 5810 | const char *encoding; |
| 5811 | |
| 5812 | ctxt = htmlNewSAXParserCtxt(sax, user_data); |
| 5813 | if (ctxt == NULL) |
| 5814 | return(NULL); |
| 5815 | |
| 5816 | encoding = xmlGetCharEncodingName(enc); |
| 5817 | input = xmlNewInputPush(ctxt, filename, chunk, size, encoding); |
| 5818 | if (input == NULL) { |
| 5819 | htmlFreeParserCtxt(ctxt); |
| 5820 | return(NULL); |
| 5821 | } |
| 5822 | inputPush(ctxt, input); |
| 5823 | |
| 5824 | return(ctxt); |
| 5825 | } |
| 5826 | #endif /* LIBXML_PUSH_ENABLED */ |
| 5827 | |
| 5828 | /** |