mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
html: Move DTD creation to endDocument SAX callback
This commit is contained in:
27
HTMLparser.c
27
HTMLparser.c
@@ -4331,8 +4331,6 @@ htmlCtxtParseContentInternal(htmlParserCtxtPtr ctxt, xmlParserInputPtr input) {
|
||||
*/
|
||||
int
|
||||
htmlParseDocument(htmlParserCtxtPtr ctxt) {
|
||||
xmlDtdPtr dtd;
|
||||
|
||||
if ((ctxt == NULL) || (ctxt->input == NULL))
|
||||
return(-1);
|
||||
|
||||
@@ -4429,17 +4427,6 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
|
||||
if ((!(ctxt->options & HTML_PARSE_NODEFDTD)) && (ctxt->myDoc != NULL)) {
|
||||
dtd = xmlGetIntSubset(ctxt->myDoc);
|
||||
if (dtd == NULL) {
|
||||
ctxt->myDoc->intSubset =
|
||||
xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "html",
|
||||
BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN",
|
||||
BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd");
|
||||
if (ctxt->myDoc->intSubset == NULL)
|
||||
htmlErrMemory(ctxt);
|
||||
}
|
||||
}
|
||||
if (! ctxt->wellFormed) return(-1);
|
||||
return(0);
|
||||
}
|
||||
@@ -5158,20 +5145,6 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
|
||||
if ((!(ctxt->options & HTML_PARSE_NODEFDTD)) &&
|
||||
(ctxt->myDoc != NULL)) {
|
||||
xmlDtdPtr dtd;
|
||||
dtd = xmlGetIntSubset(ctxt->myDoc);
|
||||
if (dtd == NULL) {
|
||||
ctxt->myDoc->intSubset =
|
||||
xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "html",
|
||||
BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN",
|
||||
BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd");
|
||||
if (ctxt->myDoc->intSubset == NULL)
|
||||
htmlErrMemory(ctxt);
|
||||
}
|
||||
}
|
||||
|
||||
ctxt->instate = XML_PARSER_EOF;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user