Radu Coravu created XERCESJ-1635:
------------------------------------
Summary: Report warning when we have undeclared entity reference
in XML content
Key: XERCESJ-1635
URL: https://issues.apache.org/jira/browse/XERCESJ-1635
Project: Xerces2-J
Issue Type: Bug
Components: DTD
Reporter: Radu Coravu
Fix For: 2.11.0
Let's say we have an XML document like this:
{code}<!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>
.......{code}
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:
{code} if (fValidation)
fErrorReporter.reportError(
XMLMessageFormatter.XML_DOMAIN,"EntityNotDeclared",
new Object[]{name},
XMLErrorReporter.SEVERITY_ERROR);
{code}
and in my opinion it should also have an "else" branch on which to report the
problem at least as a warning.
http://www.w3.org/TR/REC-xml/#include-if-valid
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]