In other words, if I have a Node named "A" with two children named "B"
and "C", would you do something like this in Java for A:
public Node cloneNode(boolean deep) {
Node newNode = new NodeImpl();
// Do attribute copies here
if (deep) {
newNode.appendChild(B);
newNode.appendChild(C);
}
return newNode;
}
or else would you do something like:
public Node cloneNode(boolean deep) {
Node newNode = new NodeImpl();
// Do attribute copies here
if (deep) {
newNode.appendChild(B.cloneNode(deep));
newNode.appendChild(C.cloneNode(deep));
}
return newNode;
}
Similiarly, what happens with the Attributes of a Node is also not too
clear to me. Are attributes copied by value or by reference as well?
What happens to the parent attribute? Should it be copied as well or
should it just have the implicit DocumentFragment reference as its
parent? What happens to the references to the siblings of a node?
Any help on these issues would be greatly appreciated...
Thanx in advance,
Tyler