Method InsertBefore
- Namespace
- SharpVectors.Dom
- Assembly
- SharpVectors.Core.dll
InsertBefore(XmlNode, XmlNode)
Inserts the node newChild
before the existing child node refChild
.
XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
Parameters
newChild
XmlNodenode to insert.
refChild
XmlNodereference node, i.e., the node before which the new node must be inserted.
Returns
- XmlNode
The node being inserted.
Remarks
If refChild
is null, insert newChild
at the end
of the list of children.
If newChild
is a IDocumentFragment object,
all of its children are inserted, in the same order, before refChild
.
newChild
is already in the tree, it is first removed.
Exceptions
- DomException
HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the
WRONG_DOCUMENT_ERR: Raised ifnewChild
node, or if the node to insert is one of this node's ancestors.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.