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 Adam Jenkins <aj...@infocomp.com> on 2005/03/23 00:56:55 UTC

factory.setExpandEntityReferences(false) bug?

Hi, just wanted to check if this is a bug.

In the crimson library, when I run the following code, The output is 7 (a
mixture of EntityReference and Text objects -- as I would expect because the
Entity objects haven't been resolved)....however when I run it in xerces,
the output is 1 (one text object).

Shouldn't entities all be handled the same regardless of whether they're
escaping special characters?  (i.e. isn't that just a special case of
entity?).

When setting 'setExpandEntityReferences(true)'....crimson and xerces both
output 1.



<snip>

		final DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
		factory.setExpandEntityReferences(false);
		final String myDatabaseString =
"&lt;test-element&gt;somedata&lt;/test-element&gt;";
		final String testString = "<dummy-root-element>" +
myDatabaseString + "</dummy-root-element>";
		final Document doc = factory.newDocumentBuilder().parse(new
ByteArrayInputStream(testString.getBytes()));
		final Element dummyRootElement =
(Element)doc.getFirstChild();
	
System.out.println(dummyRootElement.getChildNodes().getLength());

</snip>

Important notice: This message is intended for the individual(s) and entity(s) addressed. The information contained in this transmission and any attached, may be confidential and may also be the subject of legal privilege, public interest immunity or legal professional privilege. Any review, retransmission, dissemination or other use of, taking of any action in reliance upon this information by person or entities other than the recipient is prohibited and requires authorization from the sender. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person) you may not copy or deliver this message to anyone. In such cases you should destroy this message and kindly notify the sender by reply email. 

WARNING: Although Infocomp has taken reasonable precautions so that no viruses are present in this e-mail, the company cannot accept responsibility for any loss or damage arising from the use of e-mail attachments.