[EMAIL PROTECTED] wrote:
Venkat S Kota:thanks for the reply. I am using Batik 1.5.1In which case, I'm not sure why it's not cloning properly, sorry.
Hi
I have downloaded the source distribution and found that the attribute node value is ignored while creating a new node in the importNode() implementation in the AbstractDocument class. See the code snippets below.. I presume the bug Cameron mentioned is still existing but I couldn't find any open bugs describing such behaviour. Can someone explain if my understanding is incorrect?
thanks
Venkat
DOMUtilities.java
-------------------
public static Document deepCloneDocument(Document doc, DOMImplementation impl) {
Element root = doc.getDocumentElement();
Document result = impl.createDocument(root.getNamespaceURI(),
root.getNodeName(),
null);
Element rroot = result.getDocumentElement();
boolean before = true;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) {
if (n == root) {
before = false;
if (root.hasAttributes()) {
NamedNodeMap attr = root.getAttributes();
int len = attr.getLength();
for (int i = 0; i < len; i++) {
rroot.setAttributeNode((Attr)result.importNode(attr.item(i),
true));
}
}
......
AbstractDocument.java
------------------------
public Node importNode(Node importedNode, boolean deep)
throws DOMException {
...
Node result;
switch (importedNode.getNodeType()) {
case ELEMENT_NODE:
...
case ATTRIBUTE_NODE:
result = createAttributeNS(importedNode.getNamespaceURI(),
importedNode.getNodeName());
break;