version 1.53, 2000/07/12 13:46:54
|
version 1.54, 2000/08/01 23:42:54
|
Line 2472 htmlCheckEncoding(htmlParserCtxtPtr ctxt
|
Line 2472 htmlCheckEncoding(htmlParserCtxtPtr ctxt
|
handler = xmlFindCharEncodingHandler((const char *) encoding); |
handler = xmlFindCharEncodingHandler((const char *) encoding); |
if (handler != NULL) { |
if (handler != NULL) { |
xmlSwitchToEncoding(ctxt, handler); |
xmlSwitchToEncoding(ctxt, handler); |
|
ctxt->charset = XML_CHAR_ENCODING_UTF8; |
} else { |
} else { |
ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING; |
ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING; |
} |
} |
} |
} |
|
|
|
if ((ctxt->input->buf != NULL) && |
|
(ctxt->input->buf->encoder != NULL) && |
|
(ctxt->input->buf->raw != NULL) && |
|
(ctxt->input->buf->buffer != NULL)) { |
|
int nbchars; |
|
|
|
/* |
|
* convert as much as possible to the parser reading buffer. |
|
*/ |
|
nbchars = xmlCharEncInFunc(ctxt->input->buf->encoder, |
|
ctxt->input->buf->buffer, |
|
ctxt->input->buf->raw); |
|
if (nbchars < 0) { |
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
|
ctxt->sax->error(ctxt->userData, |
|
"htmlCheckEncoding: encoder error\n"); |
|
ctxt->errNo = XML_ERR_INVALID_ENCODING; |
|
} |
|
} |
} |
} |
} |
} |
|
|
Line 3468 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
Line 3489 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
avail = in->buf->buffer->use - (in->cur - in->base); |
avail = in->buf->buffer->use - (in->cur - in->base); |
if ((avail == 0) && (terminate)) { |
if ((avail == 0) && (terminate)) { |
htmlAutoClose(ctxt, NULL); |
htmlAutoClose(ctxt, NULL); |
if (ctxt->nameNr == 0) |
if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { |
|
/* |
|
* SAX: end of the document processing. |
|
*/ |
ctxt->instate = XML_PARSER_EOF; |
ctxt->instate = XML_PARSER_EOF; |
|
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) |
|
ctxt->sax->endDocument(ctxt->userData); |
|
} |
} |
} |
if (avail < 1) |
if (avail < 1) |
goto done; |
goto done; |
Line 3947 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
Line 3974 htmlParseTryOrFinish(htmlParserCtxtPtr c
|
done: |
done: |
if ((avail == 0) && (terminate)) { |
if ((avail == 0) && (terminate)) { |
htmlAutoClose(ctxt, NULL); |
htmlAutoClose(ctxt, NULL); |
if (ctxt->nameNr == 0) |
if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { |
|
/* |
|
* SAX: end of the document processing. |
|
*/ |
ctxt->instate = XML_PARSER_EOF; |
ctxt->instate = XML_PARSER_EOF; |
|
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) |
|
ctxt->sax->endDocument(ctxt->userData); |
|
} |
} |
} |
#ifdef DEBUG_PUSH |
#ifdef DEBUG_PUSH |
fprintf(stderr, "HPP: done %d\n", ret); |
fprintf(stderr, "HPP: done %d\n", ret); |