Adds a node before a given child node.
[Visual Basic] Public Sub AddBefore( _ ByVal child As XmlNode, _ ByVal before As XmlNode _ ) [C#] public void AddBefore( XmlNode child, XmlNode before ); [C++] public: void AddBefore( XmlNode* child, XmlNode* before ); [JScript] public function AddBefore( child : XmlNode, before : XmlNode );
Exception Type | Condition |
---|---|
ArgumentException | If child is null, if the Parent property of child is non-null, if child is already in the parent chain of this element, if child does not belong to the same XML context as this element, or if the parent element of before is not this element. |
The node given by child is added to this element's child list immediately before the node given by before. If before is null, the node is added to the end of this element's child list. An exception is thrown if child is already parented. To re-parent a node, the node must first be removed from the old parent.
XmlContainer Class | XmlContainer Members | System.Xml Namespace | Add | Remove