Routines (alphabetical) > Object Classes > File Format Object Classes > IDLffXMLDOMNode::ReplaceChild

# IDLffXMLDOMNode::ReplaceChild

Syntax | Return Value | Arguments | Keywords | Version History

The IDLffXMLDOMNode::ReplaceChild function method replaces an existing child node with a new child node into the calling node’s child list.

If the new child node is an IDLffXMLDOMDocumentFragment, the old child node is replaced by all the IDLffXMLDOMDocumentFragment children, which are inserted in the same order.

If the new child node is already in the tree, it is first removed.

The ownership of the IDL object to which the NewChild object reference refers is changed so that it is no longer owned by its previous owner and becomes owned by the calling object. Therefore, destroying the calling object destroys the new child as well.

The ownership of the IDL object to which the OldChild object reference refers is transferred from this calling object to the document object. The old child node has no parent after it is replaced. The document object becomes the new owner of the old child node, which is destroyed when the document object is destroyed.

## Syntax

Result = Obj->[IDLffXMLDOMNode::]ReplaceChild( NewChild, OldChild )

## Return Value

Returns an object reference to the old child node.

## Arguments

### NewChild

An object reference to an instance of an IDLffXMLDOMNode subclass that refers to the node to put into the tree, replacing the old child node.

### OldChild

An object reference to an instance of an IDLffXMLDOMNode subclass that refers to the node that is being replaced. The old child node must be a child of the calling node.

## Keywords

None

## Version History

6.1 | Introduced