Microsoft XML 2.5 SDK


 

IXMLDOMNode::cloneNode Method

[This is preliminary documentation and subject to change.]

Creates a new node that is an exact clone of this node.

Visual Basic Syntax

Set objXMLDOMNode = oXMLDOMNode.cloneNode(deep)

C/C++ Syntax

HRESULT cloneNode(

    VARIANT_BOOL deep,

    IXMLDOMNode **cloneRoot);

Parameters

deep

[in]
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.

cloneRoot

[out]
Newly created clone node.

C/C++ Return Value

S_OK

Value returned if successful.

E_INVALIDARG

Value returned if cloneRoot is null.

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 parameter flag.

Note   If the node is the IXMLDOMDocument node then it is safer to clone the document using the save method as follows:

doc.save(doc2);