Here you can find the source of cloneDocument(final Document doc)
Parameter | Description |
---|---|
doc | The document being cloned. |
public static Document cloneDocument(final Document doc)
//package com.java2s; import org.w3c.dom.Document; public class Main { /**//from w w w .j ava 2 s. c om * Creates an exact clone of a Document. * * @param doc The document being cloned. * * @return A Document with the same Element tree, or null if null is passed in. */ public static Document cloneDocument(final Document doc) { if (doc == null) { throw new IllegalArgumentException("The document source cannot be null."); } // for now do this, but it may need to be changed later if this is deemed implemenation dependent return (Document) doc.cloneNode(true); } }