Table of Contents

Method CloneNode

Namespace
SharpVectors.Dom
Assembly
SharpVectors.Core.dll

CloneNode(bool)

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent; (ParentNode is null.).

XmlNode CloneNode(bool deep)

Parameters

deep bool

true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an IElement).

Returns

XmlNode

The duplicate node.

Remarks

Cloning an IElement copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child IText node.

Cloning an IAttribute directly, as opposed to be cloned as part of an IElement cloning operation, returns a specified attribute (Specified is true).

Cloning any other type of node simply returns a copy of this node. Note that cloning an immutable subtree results in a mutable copy, but the children of an IEntityReference clone are readonly. In addition, clones of unspecified IAttribute nodes are specified. And, cloning IDocument, IDocumentType, IEntity, and INotation nodes is implementation dependent.