Programmer's Guide > Interfaces > ADocument interface > cloneDocument method
  
cloneDocument method
Creates a completely independent copy of this document. The cloned document will have no Document.documentURI or ADocument.name attributes set for it. However, the ADocument.directory attribute will be identical to the source document so that relatively-referenced resources (such as graphic files) will be correctly resolved in the context of the cloned document.
* 
You should avoid using the Document.documentURI attribute to give the cloned document a URI identical to the source document because any subsequent changes made to either document will be reflected in the other document.
cloneDocument( [flags] )
Parameters
intflags
[optional] A bitmask constructed by ORing some combination of the following constants: CLONE_EMPTY, CLONE_RESOLVE_CHANGE_TRACKING, CLONE_NO_ENT_DECLS, CLONE_XML, CLONE_CARET.
See the descriptions of these constants for more information.
Returns
Document. Cloned document.
Throws
CMSException
Raised for any error.