Replaces the children with new nodes.
<?php
$doc = new DOMDocument;
$doc->loadXML("<container><hello/></container>");
$doc->replaceChildren("beautiful", $doc->createElement("world"));
echo $doc->saveXML();
?>
The above example will output:
<?xml version="1.0"?>
beautiful
<world/>