Código PHP:
<?php
$xml = <<<XML
<all>
<books>
<book name="test" />
</books>
<books>
<book name="test1" />
</books>
</all>
XML;
$xml1 = <<<XML
<books>
<book name="add" />
</books>
XML;
$tmp = new SimpleXMLElement($xml);
$tmp1 = new SimpleXMLElement($xml1);
$tmp->addChild("books",$tmp1);
print_r($tmp);
?>