Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.11.0
-
None
-
None
Description
Let's say we have an XML document like this:
<!DOCTYPE article [ <!ENTITY % isolat1 SYSTEM "abc.ent"> %isolat1; <!ENTITY t "test" > ]> <article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"> <info> <title>Article Tem&abc;plate Title</title> .......
and the referenced "abc.ent" file is an empty entity file.
if this file is parsed by Xerces with validation turned off, the reference to the non existing entity &abc; will not be reported at all.
Usually when you apply over the XML an XSLT stylesheet the validation is turned off so in my opinion even with validation turned off at least a warning should be issued in the case in which an undeclared entity is present in the XML content because this means that the XML content is incomplete.
The extra warning could be reported in:
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEntityReference()
and:
org.apache.xerces.impl.XML11NSDocumentScannerImpl.scanEntityReference()
In that code the decision is something like:
if (fValidation) fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,"EntityNotDeclared", new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR);
and in my opinion it should also have an "else" branch on which to report the problem at least as a warning.