Description
I have a DTD file base.dtd
that declares an XML entity external
:
<?xml version="1.0" encoding="utf-8"?>
<!ELEMENT root-element (#PCDATA)>
<!ENTITY external "EXTERNALLY DECLARED ENTITY">
I have an XML file file.xml
that references the DTD file and declares an XML entity local
. To make the case clear it also uses an undeclared entity undeclared
.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE root-element SYSTEM "./base.dtd" [
<!ENTITY local "LOCALLY DECLARED ENTITY">
]>
<root-element>
&local;
&external;
&undeclared;
</root-element>
Now, if I open file.xml
in VSCode, the DTD is recognized and the &undeclared;
is correctly marked with an EntityNotDeclared
error.
However, once I modify file.xml
, e.g. by putting a new line or space anywhere (any safe place that does not break well-formdness of XML, e.g. after <root-element>
opening tag), the &external;
entity gets marked with an EntityNotDeclared
error, which is NOT correct.
Is it possible to fix it? This error is really annoying in large XML files with a lot of externally declared XML entities. Once you modify your XML it gets red all over and you easily miss your real errors in XML. Or is this a lemminx problem?
Thanks