1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 03:55:04 +03:00

html: Try to avoid passing XML options to HTML parser

This commit is contained in:
Nick Wellnhofer 2024-09-12 01:44:18 +02:00
parent 76cc63942a
commit 0ce7bfe559
2 changed files with 12 additions and 1 deletions

2
SAX2.c
View File

@ -1773,7 +1773,7 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
* intern the formatting blanks found between tags, or the
* very short strings
*/
if (ctxt->dictNames) {
if ((!ctxt->html) && (ctxt->dictNames)) {
xmlChar cur = str[len];
if ((len < (int) (2 * sizeof(void *))) &&

View File

@ -62,6 +62,7 @@
#include <libxml/xmlIO.h>
#include <libxml/uri.h>
#include <libxml/SAX2.h>
#include <libxml/HTMLparser.h>
#ifdef LIBXML_CATALOG_ENABLED
#include <libxml/catalog.h>
#endif
@ -13599,6 +13600,11 @@ xmlCtxtSetOptionsInternal(xmlParserCtxtPtr ctxt, int options, int keepMask)
int
xmlCtxtSetOptions(xmlParserCtxtPtr ctxt, int options)
{
#ifdef LIBXML_HTML_ENABLED
if ((ctxt != NULL) && (ctxt->html))
return(htmlCtxtSetOptions(ctxt, options));
#endif
return(xmlCtxtSetOptionsInternal(ctxt, options, 0));
}
@ -13651,6 +13657,11 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
{
int keepMask;
#ifdef LIBXML_HTML_ENABLED
if ((ctxt != NULL) && (ctxt->html))
return(htmlCtxtUseOptions(ctxt, options));
#endif
/*
* For historic reasons, some options can only be enabled.
*/