Click to return to the XML (Extensible Markup Language) home page    
IXMLDOMNode::childNodes P...     IXMLDOMNode::dataType Pro...     IXMLDOMNode Interface    
Web Workshop  |  XML (Extensible Markup Language)

IXMLDOMNode::cloneNode Method


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);


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.