### Method

# Lasem DomNode replace_child

#### Declaration [src]

    LsmDomNode*
    lsm_dom_node_replace_child (
      LsmDomNode* self,
      LsmDomNode* new_child,
      LsmDomNode* old_child
    )

#### Description [src]

Replaces the child node `old_child` with `new_child` in the list of children, and returns the `old_child` node. If the `new_child` is already in the tree, it is first removed.

#### Parameters

`new_child`

  Type: `LsmDomNode`

  A replacement node.

  The instance takes ownership of the data, and is responsible for freeing it.

`old_child`

  Type: `LsmDomNode`

  Node to replace.

  The data is owned by the caller of the method.

#### Return value

Type: `LsmDomNode`

The replaced node.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.