mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
Add an HTML parser option to avoid a default doctype
- include/libxml/HTMLparser.h: defines the new HTML parser option HTML_PARSE_NODEFDTD - HTMLparser.c: if option is set don't add a default DTD - xmllint.c: add the corresponding --nodefdtd option in xmllint
This commit is contained in:
@ -4670,7 +4670,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
|
||||
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
|
||||
if (ctxt->myDoc != NULL) {
|
||||
if ((!(ctxt->options & HTML_PARSE_NODEFDTD)) && (ctxt->myDoc != NULL)) {
|
||||
dtd = xmlGetIntSubset(ctxt->myDoc);
|
||||
if (dtd == NULL)
|
||||
ctxt->myDoc->intSubset =
|
||||
@ -6530,6 +6530,10 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options)
|
||||
ctxt->options |= XML_PARSE_HUGE;
|
||||
options -= XML_PARSE_HUGE;
|
||||
}
|
||||
if (options & HTML_PARSE_NODEFDTD) {
|
||||
ctxt->options |= HTML_PARSE_NODEFDTD;
|
||||
options -= HTML_PARSE_NODEFDTD;
|
||||
}
|
||||
ctxt->dictNames = 0;
|
||||
return (options);
|
||||
}
|
||||
|
Reference in New Issue
Block a user