Simple and clear only do this
$XMLRoot = new SimpleXMLElement('');
OutPut
to add attributes in element only use
$XMLRoot->addAttribute('name','juan');
to add child use
$childElement = $XMLRoot->addChild('elementChild');
$childElement->addAttribute('attribName','somthing');