Skip to content

[BUG] Folding in XML (and XHTML) files with entity declarations does not work properly #17012

@ToaKraka

Description

@ToaKraka

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

  1. If an XML (or XHTML) document contains a document type declaration, and the document type declaration contains entity declarations, then the first fold in the document will start at the starting < of the document type declaration, but will end at the ending > of the first entity declaration in the document type declaration, rather than at the ending > of the document type declaration. This does not affect folding in the rest of the document.

  2. If an XML (or XHTML) document's document type declaration contains an internal entity declaration that itself contains an XML element, the element's beginning tag is ignored by Notepad++'s folding, but the element's ending tag is not ignored. This causes folding in the rest of the document to be wrong.

Steps To Reproduce

Paste the following document into Notepad++ and save it as example.xml (or example.xhtml).

<?xml version='1.0'?>
<!DOCTYPE example [
	<!ENTITY entitydecl1 "This entity declaration breaks folding in one way.">
	<!ENTITY entitydecl2 "<p>This entity declaration breaks folding in another way.</p>">
	]>
<example>
	<div>
		<p>Observe the broken folding.</p>
		</div>
	</example>

Current Behavior

Broken folding

Image

Expected Behavior

Option 1: Proper folding in the document type declaration

Image

Option 2: No folding in the document type declaration

Image

Debug Information

Notepad++ v8.8.5   (64-bit)
Build time: Aug 14 2025 - 00:32:39
Scintilla/Lexilla included: 5.5.7/5.4.5
Boost Regex included: 1_85
Path: C:\Program Files\Notepad++\notepad++.exe
Command Line: "C:\Users\ToaKraka\Desktop\example.xml" 
Admin mode: OFF
Local Conf mode: OFF
Cloud Config: OFF
Periodic Backup: OFF
Placeholders: OFF
Scintilla Rendering Mode: SC_TECHNOLOGY_DEFAULT (0)
Multi-instance Mode: multiInst
asNotepad: OFF
File Status Auto-Detection: cdEnabledNew (for current file/tab only)
Dark Mode: OFF
Display Info:
    primary monitor: 1920x1080, scaling 100%
    visible monitors count: 2
    installed Display Class adapters: 
        0001: Description - AMD Radeon RX 6750 XT
        0001: DriverVersion - 32.0.12033.1030
OS Name: Windows 10 Pro (64-bit)
OS Version: 22H2
OS Build: 19045.6332
Current ANSI codepage: 1252
Plugins: 
    DSpellCheck (1.4.23)
    HTMLTag (1.3.5)
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions