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 "William Eliot Kimber (JIRA)" <xe...@xml.apache.org> on 2014/08/16 18:39:18 UTC

[jira] [Created] (XERCESJ-1643) Undeclared Parameter Entity Expanded in Overridden Parameter Entity Declaration

William Eliot Kimber created XERCESJ-1643:
---------------------------------------------

             Summary: Undeclared Parameter Entity Expanded in Overridden Parameter Entity Declaration
                 Key: XERCESJ-1643
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1643
             Project: Xerces2-J
          Issue Type: Bug
    Affects Versions: 2.11.0
         Environment: Java 7
            Reporter: William Eliot Kimber


Given this DTD:

<!-- Test of parameter entity expansion -->

<!ENTITY % a "a" >
<!--<!ENTITY % b "b" >-->

<!ENTITY % base-pe "(%a;)" >
<!ENTITY % base-pe "(%a; | %b;)" >

<!ELEMENT pe-test (%base-pe;) >
<!ELEMENT a EMPTY >
<!ELEMENT b EMPTY >

<!-- End of test -->

The reference to parameter entity %b is flagged as a reference to an undeclared entity.

However, the preceding declaration of %base-pe overrides the second one, meaning that the second one can never be effective and should be ignored. Therefore the reference to undeclared parameter entity %b should not be reported as an error.

>From this behavior, I'm inferring that Xerces scans all declarations and expands all parameter entity references before determining which declarations are actually effective. I think this behavior is incorrect, or at least in this case the lack of declaration for %b should be reported as a warning rather than an error, since it is not in fact an error (the reference will never be effective). The code can certainly know that the second declaration of %base-pe is the second one and therefore know that anything in it will not be used for actual validation.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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