From 655ac5f851517dfa4e619d1888c8fa0c20b11a3d Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 7 May 2025 16:35:09 +0200 Subject: [PATCH] html: Add comment regarding hack for XML documents --- HTMLtree.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/HTMLtree.c b/HTMLtree.c index 14e08927..2e579b8e 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -920,6 +920,15 @@ htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding ATTRIBUTE_UNUSED, int format) { int type = 0; + + /* + * This is needed when serializing XML documents as HTML. + * xmlEncodeEntitiesReentrant uses the document type to + * determine the serialization mode. + * + * Once we call more low-level functions directly with + * HTML flags, this hack can be removed. + */ if (cur) { type = cur->type; cur->type = XML_HTML_DOCUMENT_NODE;