You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "ivan (JIRA)" <xe...@xml.apache.org> on 2016/11/05 10:59:58 UTC

[jira] [Updated] (XERCESJ-1635) Report warning when we have undeclared entity reference in XML content

     [ https://issues.apache.org/jira/browse/XERCESJ-1635?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ivan updated XERCESJ-1635:
--------------------------
    Attachment: Suggestion_Xercesj_1635.patch

The validation has been moved to XMLDocumentFragmentScannerImpl. If I understood your suggestion the patch file should do what you expect.

> 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
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>         Attachments: Suggestion_Xercesj_1635.patch
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> 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.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org