Creates a new node that is an exact clone of this node.
Syntax
objXMLDOMNode = oXMLDOMNode.cloneNode(deep)
Parameters
- deep
- Boolean. Flag that indicates whether to recursively clone all nodes that are descendants of this node. If true, create a clone of the complete tree below this node. If false, clone this node and its attributes only.
Returns
Object. Returns the newly created clone node.
Remarks
The cloned node has the same property values as this node for the following properties: nodeName, nodeValue, nodeType, parentNode, ownerDocument, and (if it is an element) attributes. The value of the clone's childNodes property depends on the setting of the deep flag parameter.
Example
The following example clones a node, then appends it as a child of the top-level node:
Dim xmlDoc Dim root Dim currNode Dim MyNewNode Set xmlDoc = CreateObject("microsoft.xmldom") xmlDoc.async = False xmlDoc.load("c:\books.xml") Set root = xmldoc.documentElement Set currNode = root.childNodes.item(2) Set MyNewNode = currNode.cloneNode(true) root.appendChild (MyNewNode) MsgBox xmlDoc.xml
Applies To