Vincent --
The short answer to this is that the JAXP DocumentBuilderFactory created
by Xerces is initialized with isExpandedEntityReferences() set to
false. Xalan will not work with this setting since it requires that
entity references be expanded.
Therefore, change the DOM2DOM source code by commenting out:
Document xmlDoc = dBuilder.parse("birds.xml");
and replacing it with
dFactory.setExpandEntityReferences(true);
Document xmlDoc = dFactory.newDocumentBuilder().parse("birds.xml");
To add to the confusion, the DocumentBuilderFactory included with Xalan,
though never actually instantiated, does set the
isExpandedEntityReferences() to true. This is also indicated in the
javadoc.
Shane -- As part of xml-commons, you (or someone) will need to
reconcile these two versions. The official spec
(http://java.sun.com/xml/jaxp-1_1-spec.pdf) on page 41 shows the default
value set to true so that would seem to indicate that the Xalan version
is correct and the Xerces version is incorrect.
I have filed bugzilla bug 2049 with the XercesJ folk.
Gary
MAHE Vincent FTRD/DIH/REN wrote:
>
> Hello all Xalan gurus,
>
> I've tried the DOM2DOM sample with an XML file containing one internal and
> one external entities.
>
> The DOM output is serialized well but it doesn't contain any value of my
> entities.
>
> Could you tell me why ?