-
Bug
-
Resolution: Fixed
-
P4
-
1.4.1
-
1.1.1
-
sparc
-
solaris_7
-
Verified
Name: inR10064 Date: 10/26/2000
When JAXP 1.1 method org.w3c.dom.Document.importNode(Node importedNode,
boolean deep)
is used to import an attribute from another document to current document, it
returns imported attribute with non-null owner element (See test.java below).
Definition of the method in p. 1.2 "Fundamental Interfaces" of DOM Level 2 Core
(http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document) says:
" importNode introduced in DOM Level 2
....
ATTRIBUTE_NODE
The ownerElement attribute is set to null and the specified flag is set
to true on the generated Attr. The descendants of the source Attr are
recursively imported and the resulting nodes reassembled to form the
corresponding subtree. Note that the deep parameter has no effect on
Attr nodes; they always carry their children with them when imported. "
This bug presents in builds jaxp-1.1ea-b8, jaxp-1.1fcs-b9 and jaxp-1.1ea2-b10 and
affects the new test in TCK JAXP 1.1
api/org_w3c_dom/Document/ImportNodeTests.html#importNodeTest001.
------------------------------------test.java-----------------------------
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
public class test {
public static void main(String argv[]) {
try {
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document firstDoc = documentBuilder.newDocument();
Document secondDoc = documentBuilder.newDocument();
Attr attr = secondDoc.createAttribute("attribute");
Element root = secondDoc.createElement("root");
root.setAttributeNode(attr);
attr = root.getAttributeNode("attribute");
Attr attribute = (Attr)firstDoc.importNode(attr, true);
System.out.println("ownerElement = " + attribute.getOwnerElement());
} catch (Exception e) {
System.out.println("Unexpected " + e + " was thrown");
}
}
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
% java -showversion 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)
ownerElement = org.apache.crimson.tree.ElementNode@2f0db
---------------------------------------------------------------------------
======================================================================