mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
html: Ignore unexpected DOCTYPE declarations
This commit is contained in:
@ -4343,6 +4343,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
|
||||
(UPP(4) == 'C') && (UPP(5) == 'T') &&
|
||||
(UPP(6) == 'Y') && (UPP(7) == 'P') &&
|
||||
(UPP(8) == 'E')) {
|
||||
ctxt->instate = XML_PARSER_MISC;
|
||||
htmlParseDocTypeDecl(ctxt);
|
||||
}
|
||||
SKIP_BLANKS;
|
||||
@ -4350,6 +4351,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
|
||||
/*
|
||||
* Parse possible comments and PIs before any content
|
||||
*/
|
||||
ctxt->instate = XML_PARSER_PROLOG;
|
||||
while (CUR == '<') {
|
||||
if ((NXT(1) == '!') && (NXT(2) == '-') && (NXT(3) == '-')) {
|
||||
SKIP(4);
|
||||
@ -4366,6 +4368,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
|
||||
/*
|
||||
* Time to start parsing the tree itself
|
||||
*/
|
||||
ctxt->instate = XML_PARSER_CONTENT;
|
||||
htmlParseContent(ctxt);
|
||||
|
||||
/*
|
||||
|
4
SAX2.c
4
SAX2.c
@ -245,10 +245,10 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name,
|
||||
|
||||
if (ctxt->myDoc == NULL)
|
||||
return;
|
||||
if ((ctxt->html) && (ctxt->instate != XML_PARSER_MISC))
|
||||
return;
|
||||
dtd = xmlGetIntSubset(ctxt->myDoc);
|
||||
if (dtd != NULL) {
|
||||
if (ctxt->html)
|
||||
return;
|
||||
xmlUnlinkNode((xmlNodePtr) dtd);
|
||||
xmlFreeDtd(dtd);
|
||||
ctxt->myDoc->intSubset = NULL;
|
||||
|
Reference in New Issue
Block a user