Share via


INode.InsertBefore(INode, INode) Method

Definition

Inserts the node newChild before the existing child node refChild.

[Android.Runtime.Register("insertBefore", "(Lorg/w3c/dom/Node;Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;", "GetInsertBefore_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? InsertBefore (Org.W3c.Dom.INode? newChild, Org.W3c.Dom.INode? refChild);
[<Android.Runtime.Register("insertBefore", "(Lorg/w3c/dom/Node;Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node;", "GetInsertBefore_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 InsertBefore : Org.W3c.Dom.INode * Org.W3c.Dom.INode -> Org.W3c.Dom.INode

Parameters

newChild
INode

The node to insert.

refChild
INode

The reference node, i.e., the node before which the new node must be inserted.

Returns

The node being inserted.

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 insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element 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 is readonly or if the parent of the node being inserted is readonly.
NOT_FOUND_ERR: Raised if refChild 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 insertion of a DocumentType or Element node.

Remarks

Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children. <br>If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed. <p ><b>Note:</b> Inserting a node before itself is implementation dependent.

Java documentation for org.w3c.dom.Node.insertBefore(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