Replaces a given child node with another node.
[Visual Basic] Public Sub Replace( _ ByVal oldChild As XmlNode, _ ByVal newChild As XmlNode _ ) [C#] public void Replace( XmlNode oldChild, XmlNode newChild ); [C++] public: void Replace( XmlNode* oldChild, XmlNode* newChild ); [JScript] public function Replace( oldChild : XmlNode, newChild : XmlNode );
Exception Type | Condition |
---|---|
ArgumentException | If oldChild is null, if the parent of oldChild is not this element, if newChild is null, if newChild is already parented by another element, or if newChild does not belong to the same XML context as this element. |
The oldChild node is replaced with the newChild node. The parent of the newChild node must be null before the operation, and the parent of the oldChild node becomes null after the operation.
XmlContainer Class | XmlContainer Members | System.Xml Namespace