Java Node.cloneNode()
- by Tom Brito
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?