xmllint: error message "xmlAddEntity: invalid redeclaration of predefined entity" should be improved
With xmllint
, one may get error messages like:
error : xmlAddEntity: invalid redeclaration of predefined entity
error : xmlAddEntity: invalid redeclaration of predefined entity
(see #307 (closed) for the context), but there are 2 issues with these error messages:
- They do not say where the predefined entity is redefined (i.e. which file or URL).
- They do not say which predefined entity is redefined. This makes things difficult to debug, in particular when the culprit file is obtained after several inclusions and via catalogs (e.g. from "standard" DTDs); see for instance Debian bug 993638, where a better error message would have been much more useful to find the cause of the error.
For a testcase, consider test.ent
:
<!ENTITY amp "&">
<!ENTITY lt "<">
and test.xml
:
<?xml version="1.0"?>
<!DOCTYPE root [
<!ENTITY % ent-test SYSTEM "test.ent">
%ent-test;
]>
<root/>
Alternatively, these errors could entirely be dropped (if regarded as OK) as suggested in #307 (closed).