public static Document createNewDomFromNode(Node toClone){
  Document newDoc=createDomDocument();
  Node importedNode=newDoc.importNode(toClone,true);
  newDoc.appendChild(importedNode);
  return newDoc;
}

public static Document createNewDomFromNode ( Node toClone ) { Document newDoc = createDomDocument ( ) ; Node importedNode = newDoc . importNode ( toClone , true ) ; newDoc . appendChild ( importedNode ) ; return newDoc ; }
creates a new docume1nt with the node toclone as root element can be used to clone a document with createnewdomfromnode ( roottoclone )
