-
Bug
-
Resolution: Not an Issue
-
P5
-
None
-
1.1
-
sparc
-
solaris_7
Name: inR10064 Date: 12/15/2000
Children are not appended to org.w3c.dom.Entity, method appendChild() throws
DOMException with HIERARCHY_REQUEST_ERR code (See test.java below).
Section 1.1.1 "The DOM Structure Model" of DOM Level 2 Core
(http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1590626202) reads that Entity
node mays have as children follows nodes: Element, ProcessingInstruction, Comment,
Text, CDATASection, EntityReference.
This bug is found in builds jaxp-1.1ea-b07, jaxp-1.1ea-b08, jaxp-1.1ea-b09,
jaxp-1.1ea2-b10, jaxp-1.1ea2-b11, jaxp-1.1ea2-b12, jaxp-1.1ea2-b13, jaxp-1.1ea2-b14,
jaxp-1.1ea2-b15 and affects the new tests in TCK JAXP 1.1:
api/org_w3c_dom/Node/AppendChildTests.html#appendChildTest008
api/org_w3c_dom/Node/CloneNodeTests.html#cloneNodeTest01
api/org_w3c_dom/Node/CloneNodeTests.html#cloneNodeTest02
api/org_w3c_dom/Node/GetChildNodesTests.html#getChildNodesTest02
api/org_w3c_dom/Node/GetFirstChildTests.html#getFirstChildTest01
api/org_w3c_dom/Node/GetLastChildTests.html#getLastChildTest01
------------------------------------test.java-----------------------------
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import java.io.ByteArrayInputStream;
public class test {
public static void main(String argv[]) {
try {
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
String data =
"<?xml version=\"1.0\" ?>" +
"<!DOCTYPE root [" +
"<!ELEMENT root ANY>" +
"<!ENTITY ent \"foo\">" +
"]>" +
"<root/>";
ByteArrayInputStream in = new ByteArrayInputStream(data.getBytes());
Document document = documentBuilder.parse(in);
Node entity = document.getDoctype().getEntities().item(0);
Node child = document.createElement("child");
entity.appendChild(child);
System.out.println("Child was added.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
% java -showversion -cp .:jaxp1.1ea/jaxp.jar:jaxp1.1ea/crimson.jar test
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)
org.apache.crimson.tree.DomEx: HIERARCHY_REQUEST_ERR: This node isn't allowed there.
at org.apache.crimson.tree.NodeBase.appendChild(NodeBase.java:282)
at test.main(test.java:32)
---------------------------------------------------------------------------
======================================================================