共用方式為


INode.CloneNode(Boolean) Method

Definition

Returns a duplicate of this node, i.

[Android.Runtime.Register("cloneNode", "(Z)Lorg/w3c/dom/Node;", "GetCloneNode_ZHandler:Org.W3c.Dom.INodeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.INode? CloneNode (bool deep);
[<Android.Runtime.Register("cloneNode", "(Z)Lorg/w3c/dom/Node;", "GetCloneNode_ZHandler:Org.W3c.Dom.INodeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member CloneNode : bool -> Org.W3c.Dom.INode

Parameters

deep
Boolean

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

Returns

The duplicate node.

Attributes

Remarks

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) and no user data. User data associated to the imported node is not carried over. However, if any UserDataHandlers has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns. <br>Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone. This includes text contained in an the Element since the text is contained in a child Text node. Cloning an Attr directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute (specified is true). Cloning an Attr always clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning an EntityReference automatically constructs its subtree if a corresponding Entity is available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node. <br>Note that cloning an immutable subtree results in a mutable copy, but the children of an EntityReference clone are readonly . In addition, clones of unspecified Attr nodes are specified. And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.

Java documentation for org.w3c.dom.Node.cloneNode(boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to