well, i found with your method i had to do more loop parsing...
this is what i ended up with (all my documents have a single parent, and multiple children... e.g. <colors><color/><color/><color/></colors> so nested children wasnt addressed)
function simplexml_merge ($xmlDocs)
{
foreach ($xmlDocs as $xmlDoc)
{
${'dom'.$xmlDoc} = new DOMDocument();
${'xml'.$xmlDoc} = simplexml_load_file($xmlDoc.'.xml');
${'dom'.$xmlDoc}->loadXML(${'xml'.$xmlDoc}->asXML());
${'xpath'.$xmlDoc} = new domXPath(${'dom'.$xmlDoc});
${'xpathQuery'.$xmlDoc} = ${'xpath'.$xmlDoc}->query('/*/*');
}
$j=0;
foreach ($xmlDocs as $xmlDoc)
{
if($j != 0)
{
for ($i = 0; $i < ${'xpathQuery'.$xmlDoc}->length; $i++)
{
${'dom'.$xmlDocs[0]}->documentElement->appendChild(${'dom'.$xmlDocs[0]}->importNode(${'xpathQuery'.$xmlDoc}->item($i), true));
}
}
$j++;
}
//return ${'dom'.$xmlDocs[0]}->saveXML();
return $outputXML = simplexml_import_dom(${'dom'.$xmlDocs[0]});
}
$xmlDocs = array(1,2,3,4,5,6,7);
print_r( simplexml_merge($xmlDocs) );