Udostępnij za pośrednictwem


INode.ReplaceChild(INode, INode) Method

Definition

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

[Android.Runtime.Register("replaceChild", "(Lorg/w3c/dom/Node;Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;", "GetReplaceChild_Lorg_w3c_dom_Node_Lorg_w3c_dom_Node_Handler:Org.W3c.Dom.INodeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.INode? ReplaceChild (Org.W3c.Dom.INode? newChild, Org.W3c.Dom.INode? oldChild);
[<Android.Runtime.Register("replaceChild", "(Lorg/w3c/dom/Node;Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;", "GetReplaceChild_Lorg_w3c_dom_Node_Lorg_w3c_dom_Node_Handler:Org.W3c.Dom.INodeInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member ReplaceChild : Org.W3c.Dom.INode * Org.W3c.Dom.INode -> Org.W3c.Dom.INode

Parameters

newChild
INode

The new node to put in the child list.

oldChild
INode

The node being replaced in the list.

Returns

The node replaced.

Attributes

Exceptions

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors or this node itself, or if this node is of type Document and the result of the replacement operation would add a second DocumentType or Element on the Document node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.
NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
NOT_SUPPORTED_ERR: if this node is of type Document, this exception might be raised if the DOM implementation doesn't support the replacement of the DocumentType child or Element child.

Remarks

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. <br>If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed. <p ><b>Note:</b> Replacing a node with itself is implementation dependent.

Java documentation for org.w3c.dom.Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node).

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