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 Ramesh <ra...@enode.com> on 2000/06/11 08:39:35 UTC

Parameter Entities don't work in Xerces if...

If I change the document-class-name property to a class derived from 
org.apache.xerces.dom.DocumentImpl, then parameter entities stop working in
SOME cases, but continue to work in others! I am using Xerces 1.1.1.

Here is a simple test case using external parameter entities:

<!-- ======================================== -->
<?xml version = "1.0" ?>
<!DOCTYPE foo SYSTEM "my.dtd" []>
<foo>
    <something/>
</foo>
<!-- ======================================== -->

where, the contents of "my.dtd" are:

<!-- ======================================== -->
<!ENTITY % myEntity 'something'>
<!ELEMENT other (#PCDATA)>
<!ELEMENT something (#PCDATA)>
<!ELEMENT foo (other?, (%myEntity;)*)>
<!-- ======================================== -->

With namespaces feature turned off, and validation turned on, I get an
error:
The content of element type "foo" must match "<other,other*>".

Note that the error says <other,other*>, not <other,something*>. The error
goes away if I reverse the order in which something and other are declared
in the external DTD file! The problem also disappears if I do not change the
document-class-name property of the DOMParser.

Does anybody know why this is happening, or how to avoid the problem?

Thanks,

Ramesh