Java Node.cloneNode()
Posted
by Tom Brito
on Stack Overflow
See other posts from Stack Overflow
or by Tom Brito
Published on 2010-03-30T17:23:56Z
Indexed on
2010/03/30
17:33 UTC
Read the original article
Hit count: 339
Talking about the org.w3c.dom package; When I call Node.cloneNode() method from a Element(extends Node) object, which Document is used to create the new cloned Element?
Example:
import org.w3c.dom;
class MyClass {
public static void main(String[] args) throws Exception {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.newDocument();
Element element = doc.createElement("myElement");
Element cloneElement = (Element) element.cloneNode(true);
}
}
Which Document was used to create cloneElement?
© Stack Overflow or respective owner