<items>
<model>volvo</model>
<model>Lada</model>
</items>
$dom_xml = new DomDocument();
$xml= <<<XML
<car>
<model>volvo</model>
<model>Lada</model>
</car>
XML;
$dom_xml->Load($xml);
$mod = $dom_xml->getElementsByTagName("car");
$items = $dom_xml->createElement('items');
$items ->appendChild($mod );
$dom_xml->appendChild($items );
$xml= $dom_xml->saveXML();
<?php
$dom_xml = new domDocument();
$xml= <<<XML
<car>
<model>volvo</model>
<model>Lada</model>
<fdsdf>Lada</fdsdf>
<qwqw>Lada</qwqw>
<model>Lada</model>
<fdsdfsdfs>Lada</fdsdfsdfs>
<sd>ASD</sd>
<bv>213</bv>
</car>
XML;
$dom_xml->LoadXml($xml);
$dom_xml->formatOutput = TRUE;
$car = $dom_xml->getElementsByTagName("car")->item(0);
$car_childs = $car->childNodes;
$dom_items = $dom_xml->createElement('items');
foreach($car_childs as $mod){
if($mod->tagName != null){
$dom_element = $dom_xml->createElement($mod->tagName, $mod->nodeValue);
$dom_items ->appendChild($dom_element);
}
}
$dom_xml ->appendChild($dom_items );
//удаляем узел car
//$dom_xml->removeChild($car);
$xml= $dom_xml->save('new.xml')
<?xml version="1.0"?>
<car>
<model>volvo</model>
<model>Lada</model>
<fdsdf>Lada</fdsdf>
<qwqw>Lada</qwqw>
<model>Lada</model>
<fdsdfsdfs>Lada</fdsdfsdfs>
<sd>ASD</sd>
<bv>213</bv>
</car>
<items>
<model>volvo</model>
<model>Lada</model>
<fdsdf>Lada</fdsdf>
<qwqw>Lada</qwqw>
<model>Lada</model>
<fdsdfsdfs>Lada</fdsdfsdfs>
<sd>ASD</sd>
<bv>213</bv>
</items>